@coveo/atomic 3.33.8-pre.f62f2d7753 → 3.33.8-pre.f68a2ba413

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 (182) hide show
  1. package/dist/atomic/_atomic.esm.js +1 -1
  2. package/dist/atomic/atomic.esm.js.map +1 -1
  3. package/dist/atomic/components/_index.d.ts +2 -0
  4. package/dist/atomic/components/_index.js +1 -0
  5. package/dist/atomic/components/analytics-config.js +1 -1
  6. package/dist/atomic/components/atomic-category-facet.js +1 -1
  7. package/dist/atomic/components/atomic-facet.js +1 -1
  8. package/dist/atomic/components/atomic-format-currency.js +1 -1
  9. package/dist/atomic/components/atomic-format-number.js +1 -1
  10. package/dist/atomic/components/atomic-format-unit.js +1 -1
  11. package/dist/atomic/components/atomic-insight-search-box.js +2 -29
  12. package/dist/atomic/components/atomic-insight-search-box.js.map +1 -1
  13. package/dist/atomic/components/atomic-numeric-facet.js +1 -1
  14. package/dist/atomic/components/atomic-quickview-modal2.js +1 -1
  15. package/dist/atomic/components/atomic-quickview.js +1 -1
  16. package/dist/atomic/components/atomic-result-children.js +1 -1
  17. package/dist/atomic/components/atomic-result-fields-list.js +1 -1
  18. package/dist/atomic/components/atomic-result-link.js +1 -1
  19. package/dist/atomic/components/atomic-result-list.js +1 -1
  20. package/dist/atomic/components/atomic-search-box-query-suggestions.d.ts +11 -0
  21. package/dist/atomic/components/atomic-search-box-query-suggestions.js +8 -0
  22. package/dist/atomic/components/atomic-search-box-query-suggestions.js.map +1 -0
  23. package/dist/atomic/components/atomic-search-box-query-suggestions2.js +89 -0
  24. package/dist/atomic/components/atomic-search-box-query-suggestions2.js.map +1 -0
  25. package/dist/atomic/components/atomic-search-box-recent-queries2.js +1 -1
  26. package/dist/atomic/components/atomic-search-box.js +22 -5
  27. package/dist/atomic/components/atomic-search-box.js.map +1 -1
  28. package/dist/atomic/components/atomic-smart-snippet-feedback-modal2.js +2 -2
  29. package/dist/atomic/components/atomic-sort-dropdown.js +2 -2
  30. package/dist/atomic/components/atomic-sort-expression.js +1 -1
  31. package/dist/atomic/components/atomic-tab-manager.js +1 -1
  32. package/dist/atomic/components/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.js +18 -11
  33. package/dist/atomic/components/components/commerce/atomic-commerce-interface/atomic-commerce-interface.js +51 -14
  34. package/dist/atomic/components/components/commerce/atomic-commerce-layout/atomic-commerce-layout.js +19 -10
  35. package/dist/atomic/components/components/commerce/atomic-commerce-query-summary/atomic-commerce-query-summary.js +2 -2
  36. package/dist/atomic/components/components/commerce/atomic-commerce-recommendation-interface/atomic-commerce-recommendation-interface.js +25 -10
  37. package/dist/atomic/components/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.js +12 -5
  38. package/dist/atomic/components/components/common/atomic-modal/atomic-modal.js +2 -0
  39. package/dist/atomic/components/components/common/layout/layout-styles-controller.js +40 -0
  40. package/dist/atomic/components/components/common/layout/mobile-breakpoint-controller.js +26 -0
  41. package/dist/atomic/components/components/search/index.js +0 -1
  42. package/dist/atomic/components/components/search/lazy-index.js +0 -1
  43. package/dist/atomic/components/global/environment.js +1 -1
  44. package/dist/atomic/components/index.js.map +1 -1
  45. package/dist/atomic/components/stencil-query-suggestions.js +33 -0
  46. package/dist/atomic/components/stencil-query-suggestions.js.map +1 -0
  47. package/dist/atomic/{p-75e00690.entry.js → p-089be992.entry.js} +2 -2
  48. package/dist/atomic/{p-4b3d253b.entry.js → p-09a3a067.entry.js} +2 -2
  49. package/dist/atomic/{p-7b899b57.entry.js → p-1d1f54a5.entry.js} +2 -2
  50. package/dist/atomic/p-26a51a77.entry.js +2 -0
  51. package/dist/atomic/p-26a51a77.entry.js.map +1 -0
  52. package/dist/atomic/{p-e5352270.entry.js → p-2a0edc53.entry.js} +2 -2
  53. package/dist/atomic/{p-ae98c582.entry.js → p-2ce8220a.entry.js} +2 -2
  54. package/dist/atomic/{p-877d35b1.entry.js → p-3b023e83.entry.js} +2 -2
  55. package/dist/atomic/{p-52ba404c.entry.js → p-49c38b27.entry.js} +2 -2
  56. package/dist/atomic/p-4c2f230f.entry.js +2 -0
  57. package/dist/atomic/p-4c2f230f.entry.js.map +1 -0
  58. package/dist/atomic/{p-b24d432b.entry.js → p-5aeb70f7.entry.js} +2 -2
  59. package/dist/atomic/{p-d00a12e9.entry.js → p-5f1fa581.entry.js} +2 -2
  60. package/dist/atomic/p-744da781.entry.js +2 -0
  61. package/dist/atomic/{p-c88a3d2d.entry.js.map → p-744da781.entry.js.map} +1 -1
  62. package/dist/atomic/{p-a760d9f9.entry.js → p-7e2109e9.entry.js} +2 -2
  63. package/dist/atomic/{p-b28011e6.entry.js → p-89085429.entry.js} +2 -2
  64. package/dist/atomic/{p-39e63678.entry.js → p-89ab44de.entry.js} +2 -2
  65. package/dist/atomic/{p-330e6e7c.entry.js → p-9c9b1965.entry.js} +2 -2
  66. package/dist/atomic/{p-78b70622.entry.js → p-a8882a2a.entry.js} +2 -2
  67. package/dist/atomic/p-af93b44c.js +2 -0
  68. package/dist/atomic/p-af93b44c.js.map +1 -0
  69. package/dist/atomic/{p-f22bcb8c.entry.js → p-b6963bae.entry.js} +2 -2
  70. package/dist/atomic/{p-3c8d109e.entry.js → p-b7063a0d.entry.js} +2 -2
  71. package/dist/atomic/{p-b87dbae7.js → p-bdef1a01.js} +2 -2
  72. package/dist/atomic/{p-9d6b988d.entry.js → p-cdbc9a51.entry.js} +2 -2
  73. package/dist/atomic/{p-7b0b9e9b.entry.js → p-f289269f.entry.js} +2 -2
  74. package/dist/atomic/{p-c49cfa0c.entry.js → p-fda26113.entry.js} +2 -2
  75. package/dist/cjs/_loader.cjs.js +1 -1
  76. package/dist/cjs/{analytics-config-de93a689.js → analytics-config-d6c4fe79.js} +2 -2
  77. package/dist/cjs/{analytics-config-de93a689.js.map → analytics-config-d6c4fe79.js.map} +1 -1
  78. package/dist/cjs/atomic-category-facet.cjs.entry.js +1 -1
  79. package/dist/cjs/atomic-facet.cjs.entry.js +1 -1
  80. package/dist/cjs/atomic-format-currency.cjs.entry.js +1 -1
  81. package/dist/cjs/atomic-format-number.cjs.entry.js +1 -1
  82. package/dist/cjs/atomic-format-unit.cjs.entry.js +1 -1
  83. package/dist/cjs/atomic-insight-interface.cjs.entry.js +1 -1
  84. package/dist/cjs/atomic-insight-search-box.cjs.entry.js +4 -30
  85. package/dist/cjs/atomic-insight-search-box.cjs.entry.js.map +1 -1
  86. package/dist/cjs/atomic-numeric-facet.cjs.entry.js +1 -1
  87. package/dist/cjs/atomic-quickview-modal.cjs.entry.js +1 -1
  88. package/dist/cjs/atomic-quickview.cjs.entry.js +1 -1
  89. package/dist/cjs/atomic-recs-interface.cjs.entry.js +1 -1
  90. package/dist/cjs/atomic-result-children.cjs.entry.js +1 -1
  91. package/dist/cjs/atomic-result-fields-list.cjs.entry.js +1 -1
  92. package/dist/cjs/atomic-result-link.cjs.entry.js +1 -1
  93. package/dist/cjs/atomic-result-list.cjs.entry.js +1 -1
  94. package/dist/cjs/{atomic-search-box-recent-queries.cjs.entry.js → atomic-search-box-query-suggestions_2.cjs.entry.js} +68 -5
  95. package/dist/cjs/atomic-search-box-query-suggestions_2.cjs.entry.js.map +1 -0
  96. package/dist/cjs/atomic-search-box.cjs.entry.js +15 -4
  97. package/dist/cjs/atomic-search-box.cjs.entry.js.map +1 -1
  98. package/dist/cjs/atomic-search-interface.cjs.entry.js +1 -1
  99. package/dist/cjs/atomic-smart-snippet-feedback-modal.cjs.entry.js +2 -2
  100. package/dist/cjs/atomic-sort-dropdown.cjs.entry.js +2 -2
  101. package/dist/cjs/atomic-sort-expression.cjs.entry.js +1 -1
  102. package/dist/cjs/atomic-tab-manager.cjs.entry.js +1 -1
  103. package/dist/cjs/atomic.cjs.js +1 -1
  104. package/dist/cjs/index-757bc886.js +2 -2
  105. package/dist/cjs/stencil-query-suggestions-03268ecc.js +38 -0
  106. package/dist/cjs/stencil-query-suggestions-03268ecc.js.map +1 -0
  107. package/dist/cjs/version.cjs.js +2 -2
  108. package/dist/esm/_loader.js +1 -1
  109. package/dist/esm/{analytics-config-018337bf.js → analytics-config-a469b739.js} +2 -2
  110. package/dist/esm/{analytics-config-018337bf.js.map → analytics-config-a469b739.js.map} +1 -1
  111. package/dist/esm/atomic-category-facet.entry.js +1 -1
  112. package/dist/esm/atomic-facet.entry.js +1 -1
  113. package/dist/esm/atomic-format-currency.entry.js +1 -1
  114. package/dist/esm/atomic-format-number.entry.js +1 -1
  115. package/dist/esm/atomic-format-unit.entry.js +1 -1
  116. package/dist/esm/atomic-insight-interface.entry.js +1 -1
  117. package/dist/esm/atomic-insight-search-box.entry.js +3 -29
  118. package/dist/esm/atomic-insight-search-box.entry.js.map +1 -1
  119. package/dist/esm/atomic-numeric-facet.entry.js +1 -1
  120. package/dist/esm/atomic-quickview-modal.entry.js +1 -1
  121. package/dist/esm/atomic-quickview.entry.js +1 -1
  122. package/dist/esm/atomic-recs-interface.entry.js +1 -1
  123. package/dist/esm/atomic-result-children.entry.js +1 -1
  124. package/dist/esm/atomic-result-fields-list.entry.js +1 -1
  125. package/dist/esm/atomic-result-link.entry.js +1 -1
  126. package/dist/esm/atomic-result-list.entry.js +1 -1
  127. package/dist/esm/{atomic-search-box-recent-queries.entry.js → atomic-search-box-query-suggestions_2.entry.js} +70 -8
  128. package/dist/esm/atomic-search-box-query-suggestions_2.entry.js.map +1 -0
  129. package/dist/esm/atomic-search-box.entry.js +15 -4
  130. package/dist/esm/atomic-search-box.entry.js.map +1 -1
  131. package/dist/esm/atomic-search-interface.entry.js +1 -1
  132. package/dist/esm/atomic-smart-snippet-feedback-modal.entry.js +2 -2
  133. package/dist/esm/atomic-sort-dropdown.entry.js +2 -2
  134. package/dist/esm/atomic-sort-expression.entry.js +1 -1
  135. package/dist/esm/atomic-tab-manager.entry.js +1 -1
  136. package/dist/esm/atomic.js +1 -1
  137. package/dist/esm/index-3f35faca.js +2 -2
  138. package/dist/esm/stencil-query-suggestions-5d6a46d7.js +33 -0
  139. package/dist/esm/stencil-query-suggestions-5d6a46d7.js.map +1 -0
  140. package/dist/esm/version.js +2 -2
  141. package/dist/types/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.d.ts +2 -1
  142. package/dist/types/components/commerce/atomic-commerce-interface/atomic-commerce-interface.d.ts +29 -2
  143. package/dist/types/components/commerce/atomic-commerce-layout/atomic-commerce-layout.d.ts +3 -3
  144. package/dist/types/components/commerce/atomic-commerce-recommendation-interface/atomic-commerce-recommendation-interface.d.ts +1 -0
  145. package/dist/types/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.d.ts +1 -0
  146. package/dist/types/components/common/layout/layout-styles-controller.d.ts +22 -0
  147. package/dist/types/components/common/layout/mobile-breakpoint-controller.d.ts +18 -0
  148. package/dist/types/components/search/atomic-search-box/atomic-search-box.d.ts +1 -0
  149. package/dist/types/components/search/index.d.ts +0 -1
  150. package/dist/types/components/search/search-box-suggestions/atomic-search-box-query-suggestions/atomic-search-box-query-suggestions.d.ts +29 -0
  151. package/dist/types/components.d.ts +49 -0
  152. package/docs/atomic-docs.json +102 -3
  153. package/package.json +3 -3
  154. package/dist/atomic/components/components/search/atomic-search-box-query-suggestions/atomic-search-box-query-suggestions.js +0 -111
  155. package/dist/atomic/p-7a06a356.entry.js +0 -2
  156. package/dist/atomic/p-7a06a356.entry.js.map +0 -1
  157. package/dist/atomic/p-c88a3d2d.entry.js +0 -2
  158. package/dist/atomic/p-d2b14ff1.entry.js +0 -2
  159. package/dist/atomic/p-d2b14ff1.entry.js.map +0 -1
  160. package/dist/cjs/atomic-search-box-recent-queries.cjs.entry.js.map +0 -1
  161. package/dist/esm/atomic-search-box-recent-queries.entry.js.map +0 -1
  162. package/dist/types/components/search/atomic-search-box-query-suggestions/atomic-search-box-query-suggestions.d.ts +0 -38
  163. /package/dist/atomic/{p-75e00690.entry.js.map → p-089be992.entry.js.map} +0 -0
  164. /package/dist/atomic/{p-4b3d253b.entry.js.map → p-09a3a067.entry.js.map} +0 -0
  165. /package/dist/atomic/{p-7b899b57.entry.js.map → p-1d1f54a5.entry.js.map} +0 -0
  166. /package/dist/atomic/{p-e5352270.entry.js.map → p-2a0edc53.entry.js.map} +0 -0
  167. /package/dist/atomic/{p-ae98c582.entry.js.map → p-2ce8220a.entry.js.map} +0 -0
  168. /package/dist/atomic/{p-877d35b1.entry.js.map → p-3b023e83.entry.js.map} +0 -0
  169. /package/dist/atomic/{p-52ba404c.entry.js.map → p-49c38b27.entry.js.map} +0 -0
  170. /package/dist/atomic/{p-b24d432b.entry.js.map → p-5aeb70f7.entry.js.map} +0 -0
  171. /package/dist/atomic/{p-d00a12e9.entry.js.map → p-5f1fa581.entry.js.map} +0 -0
  172. /package/dist/atomic/{p-a760d9f9.entry.js.map → p-7e2109e9.entry.js.map} +0 -0
  173. /package/dist/atomic/{p-b28011e6.entry.js.map → p-89085429.entry.js.map} +0 -0
  174. /package/dist/atomic/{p-39e63678.entry.js.map → p-89ab44de.entry.js.map} +0 -0
  175. /package/dist/atomic/{p-330e6e7c.entry.js.map → p-9c9b1965.entry.js.map} +0 -0
  176. /package/dist/atomic/{p-78b70622.entry.js.map → p-a8882a2a.entry.js.map} +0 -0
  177. /package/dist/atomic/{p-f22bcb8c.entry.js.map → p-b6963bae.entry.js.map} +0 -0
  178. /package/dist/atomic/{p-3c8d109e.entry.js.map → p-b7063a0d.entry.js.map} +0 -0
  179. /package/dist/atomic/{p-b87dbae7.js.map → p-bdef1a01.js.map} +0 -0
  180. /package/dist/atomic/{p-9d6b988d.entry.js.map → p-cdbc9a51.entry.js.map} +0 -0
  181. /package/dist/atomic/{p-7b0b9e9b.entry.js.map → p-f289269f.entry.js.map} +0 -0
  182. /package/dist/atomic/{p-c49cfa0c.entry.js.map → p-fda26113.entry.js.map} +0 -0
@@ -43,9 +43,9 @@ const AtomicSmartSnippetFeedbackModal = /*@__PURE__*/ proxyCustomElement(class A
43
43
  }
44
44
  render() {
45
45
  updateBreakpoints(this.host);
46
- return (h("atomic-modal", { key: '4e420c4844f6ba7d674002bfb73048cfe34d6aaf', fullscreen: false, source: this.source, container: this.host, isOpen: this.isOpen, close: () => this.close(), exportparts: ATOMIC_MODAL_EXPORT_PARTS }, h(SmartSnippetFeedbackModalHeader, { key: '6a72e3297ed7126cf69563911d85aab6c27ff091', i18n: this.bindings.i18n }), h(SmartSnippetFeedbackModalBody, { key: '89a48d8530720bd17b5f642dea7725078cf214c3', formId: this.formId, onSubmit: (e) => this.sendFeedback(e) }, h(SmartSnippetFeebackModalOptions, { key: 'b3d59af560b6bb32592f246f8430e5b63361bfd2', i18n: this.bindings.i18n }, smartSnippetFeedbackOptions.map(({ id, localeKey, correspondingAnswer }) => (h(SmartSnippetFeedbackModalOption, { correspondingAnswer: correspondingAnswer, currentAnswer: this.currentAnswer, i18n: this.bindings.i18n, id: id, localeKey: localeKey, onChange: () => {
46
+ return (h("atomic-modal", { key: '9127d19a2ae3750d7b1ee60f90007d2b435ed962', fullscreen: false, source: this.source, container: this.host, isOpen: this.isOpen, close: () => this.close(), exportparts: ATOMIC_MODAL_EXPORT_PARTS }, h(SmartSnippetFeedbackModalHeader, { key: '7bdbc6c7c5ca9c51bae303807c2ac5942067db06', i18n: this.bindings.i18n }), h(SmartSnippetFeedbackModalBody, { key: 'b14f845aa76c05ba5b9781a489ddccc0e2d56a7f', formId: this.formId, onSubmit: (e) => this.sendFeedback(e) }, h(SmartSnippetFeebackModalOptions, { key: 'c8c06039213307ad1843770e2b2601159d851ed3', i18n: this.bindings.i18n }, smartSnippetFeedbackOptions.map(({ id, localeKey, correspondingAnswer }) => (h(SmartSnippetFeedbackModalOption, { correspondingAnswer: correspondingAnswer, currentAnswer: this.currentAnswer, i18n: this.bindings.i18n, id: id, localeKey: localeKey, onChange: () => {
47
47
  this.currentAnswer = correspondingAnswer;
48
- } })))), h(SmartSnippetFeedbackModalDetails, { key: '33e65c38e5cf9fcf64e29391ad532d455ddbdc03', currentAnswer: this.currentAnswer, i18n: this.bindings.i18n, setDetailsInputRef: (ref) => (this.detailsInputRef = ref) })), h(SmartSnippetFeedbackModalFooter, { key: 'c1e92161506d150cc1c1edbb2594281a706a6143', formId: this.formId, i18n: this.bindings.i18n, onClick: () => this.close() })));
48
+ } })))), h(SmartSnippetFeedbackModalDetails, { key: '662eec5d7356b9991d88312425f2575e97d77902', currentAnswer: this.currentAnswer, i18n: this.bindings.i18n, setDetailsInputRef: (ref) => (this.detailsInputRef = ref) })), h(SmartSnippetFeedbackModalFooter, { key: '5f6427113ee0734b4d501f8201f11b32f6b3537b', formId: this.formId, i18n: this.bindings.i18n, onClick: () => this.close() })));
49
49
  }
50
50
  close() {
51
51
  this.isOpen = false;
@@ -117,8 +117,8 @@ const AtomicSortDropdown$1 = /*@__PURE__*/ proxyCustomElement(class AtomicSortDr
117
117
  const { hasError, hasResults, firstSearchExecuted } = this.searchStatusState;
118
118
  const { bindings: { i18n }, id, } = this;
119
119
  return [
120
- h(SortGuard, { key: 'de3cefc2f8ba7dacb299dd569ca97d4d93a54249', firstSearchExecuted: firstSearchExecuted, hasError: hasError, hasResults: hasResults }, h(SortContainer, { key: '5a7296ed5a7f379509399ef260a344210c17ff34' }, h(SortLabel, { key: '1448eb9996a0b6a2df55f9ce880cd54c3312640d', i18n: i18n, id: id }), h(SortSelect, { key: '273f27873cfb73092eb7d98ef742536f3bb5fac5', i18n: i18n, id: id, onSelect: (evt) => this.select(evt) }, this.options.map(({ label, criteria, expression }) => (h(SortOption, { i18n: i18n, label: label, selected: this.sort.isSortedBy(criteria), value: expression })))))),
121
- h("slot", { key: 'd1058cd5f4e28bca8816e6987ec2f3a72b2d4825' }),
120
+ h(SortGuard, { key: '13b57531b5cbe4d96cdd8a6da8cc2e51a7cb5c09', firstSearchExecuted: firstSearchExecuted, hasError: hasError, hasResults: hasResults }, h(SortContainer, { key: '6669f4b0017f7bdf92b2a0310c82dc2ad9ede435' }, h(SortLabel, { key: '2fb9759cc247e03e5c00a515a3de858b7ae6e316', i18n: i18n, id: id }), h(SortSelect, { key: '451912937924b88a4c53cc07a1f4945a5ae29d90', i18n: i18n, id: id, onSelect: (evt) => this.select(evt) }, this.options.map(({ label, criteria, expression }) => (h(SortOption, { i18n: i18n, label: label, selected: this.sort.isSortedBy(criteria), value: expression })))))),
121
+ h("slot", { key: 'b7ff8bfb88f3a07462f058e5ef0bf3e41e761646' }),
122
122
  ];
123
123
  }
124
124
  get host() { return this; }
@@ -47,7 +47,7 @@ const AtomicSortExpression$1 = /*@__PURE__*/ proxyCustomElement(class AtomicSort
47
47
  const dropdownComponent = 'atomic-sort-dropdown';
48
48
  if (!this.host.closest(dropdownComponent)) {
49
49
  const error = new Error(`The "${this.host.nodeName.toLowerCase()}" component has to be used inside an ${dropdownComponent} element.`);
50
- return (h("atomic-component-error", { key: 'c0181fed2562ac8d51cba8d9a2395ab3fc431295', element: this.host, error: error }));
50
+ return (h("atomic-component-error", { key: 'e6c396c032fee71b5255255fc78606a85b554c22', element: this.host, error: error }));
51
51
  }
52
52
  }
53
53
  get host() { return this; }
@@ -59,7 +59,7 @@ const AtomicTabManager$1 = /*@__PURE__*/ proxyCustomElement(class AtomicTabManag
59
59
  });
60
60
  }
61
61
  render() {
62
- return (h(Host, { key: '6e72dfdd25eae1cd7fac4e91535654c8659e96a2' }, h("atomic-tab-bar", { key: '2afb27ff6773d7e31100aff97594f06c55264844' }, h("div", { key: 'bcd422b9454a9dfe3480c8cc4e09535dae266f10', role: "list", "aria-label": "tab-area", part: "tab-area", class: "border-neutral mb-2 flex w-full flex-row border-b" }, this.tabs.map((tab) => (h("atomic-tab-button", { active: this.tabManagerState.activeTab === tab.name, label: this.bindings.i18n.t(tab.label, {
62
+ return (h(Host, { key: '177a674f1d915777f0a4e555873f30a60cd52088' }, h("atomic-tab-bar", { key: 'a06f874f12b76dec3e0b948ce126b5224a12dabf' }, h("div", { key: '3d0b23b2daf746445ea6d7dd12c4d9c008fbfbef', role: "list", "aria-label": "tab-area", part: "tab-area", class: "border-neutral mb-2 flex w-full flex-row border-b" }, this.tabs.map((tab) => (h("atomic-tab-button", { active: this.tabManagerState.activeTab === tab.name, label: this.bindings.i18n.t(tab.label, {
63
63
  defaultValue: tab.label,
64
64
  }), select: () => {
65
65
  if (!tab.tabController.state.isActive) {
@@ -115,23 +115,30 @@ let AtomicCommerceBreadbox = class AtomicCommerceBreadbox extends LitElement {
115
115
  this.breadcrumbShowMoreFocus = new FocusTargetController(this, this.bindings);
116
116
  this.breadcrumbShowLessFocus = new FocusTargetController(this, this.bindings);
117
117
  }
118
- updated(changedProperties) {
119
- super.updated(changedProperties);
118
+ willUpdate(changedProperties) {
120
119
  if (changedProperties.has('pathLimit')) {
121
120
  this.validateProps();
122
121
  }
122
+ }
123
+ updated() {
123
124
  this.adaptBreadcrumbs();
124
125
  }
125
126
  validateProps() {
126
- new Schema({
127
- pathLimit: new NumberValue({
128
- default: 3,
129
- min: 1,
130
- required: false,
131
- }),
132
- }).validate({
133
- pathLimit: this.pathLimit,
134
- });
127
+ try {
128
+ new Schema({
129
+ pathLimit: new NumberValue({
130
+ default: 3,
131
+ min: 1,
132
+ required: false,
133
+ }),
134
+ }).validate({
135
+ pathLimit: this.pathLimit,
136
+ });
137
+ }
138
+ catch (error) {
139
+ this.error = error;
140
+ return;
141
+ }
135
142
  }
136
143
  disconnectedCallback() {
137
144
  this.resizeObserver?.disconnect();
@@ -4,11 +4,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { buildCommerceEngine, buildContext, buildProductListing, buildSearch, VERSION as HEADLESS_VERSION, loadConfigurationActions, loadQueryActions, } from '@coveo/headless/commerce';
7
+ import { buildCommerceEngine, buildContext, buildProductListing, buildSearch, VERSION as HEADLESS_VERSION, loadConfigurationActions, loadContextActions, loadQueryActions, } from '@coveo/headless/commerce';
8
8
  import { provide } from '@lit/context';
9
9
  import i18next from 'i18next';
10
10
  import { css, html, LitElement } from 'lit';
11
11
  import { customElement, property, state } from 'lit/decorators.js';
12
+ import { MobileBreakpointController } from "../../common/layout/mobile-breakpoint-controller";
12
13
  import { booleanConverter } from "../../../converters/boolean-converter";
13
14
  import { errorGuard } from "../../../decorators/error-guard";
14
15
  import { watch } from "../../../decorators/watch";
@@ -85,6 +86,7 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
85
86
  this.urlManager.synchronize(this.fragment);
86
87
  };
87
88
  this.store = createCommerceStore(this.type);
89
+ new MobileBreakpointController(this, this.store);
88
90
  const { promise, resolve } = Promise.withResolvers();
89
91
  this.i18Initialized = promise;
90
92
  this.i18n = i18next.createInstance(undefined, resolve);
@@ -92,7 +94,6 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
92
94
  connectedCallback() {
93
95
  super.connectedCallback();
94
96
  this.store.setLoadingFlag(FirstRequestExecutedFlag);
95
- this.updateMobileBreakpoint();
96
97
  this.addEventListener('atomic/initializeComponent', this.handleInitialization);
97
98
  this.addEventListener('atomic/scrollToTop', this.scrollToTop);
98
99
  }
@@ -143,6 +144,41 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
143
144
  this.searchOrListing.executeFirstRequest();
144
145
  }
145
146
  }
147
+ /**
148
+ * Updates the locale settings for the commerce interface and headless commerce
149
+ * engine. Only the provided parameters will be updated.
150
+ *
151
+ * Calling this method affects the localization of the interface as well as
152
+ * the catalog configuration being used by the Commerce API. If the resulting
153
+ * language-country-currency combination matches no existing catalog
154
+ * configuration in your Coveo organization, requests made through the
155
+ * commerce engine will start failing.
156
+ *
157
+ * @param language - (Optional) The IETF language code tag (e.g., `en`).
158
+ * @param country - (Optional) The ISO-3166-1 country tag (e.g., `US`).
159
+ * @param currency - (Optional) The ISO-4217 currency code (e.g., `USD`).
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * interface.updateLocale('fr', 'CA', 'CAD');
164
+ * ```
165
+ */
166
+ updateLocale(language, country, currency) {
167
+ if (!this.interfaceController.engineIsCreated(this.engine) ||
168
+ !this.context) {
169
+ return;
170
+ }
171
+ language && this.interfaceController.onLanguageChange(language);
172
+ if (this.isNewLocale(language, country, currency)) {
173
+ const { setContext } = loadContextActions(this.engine);
174
+ this.engine.dispatch(setContext({
175
+ ...this.context.state,
176
+ ...(language && { language }),
177
+ ...(country && { country }),
178
+ ...(currency && { currency }),
179
+ }));
180
+ }
181
+ }
146
182
  toggleAnalytics() {
147
183
  this.interfaceController.onAnalyticsChange();
148
184
  }
@@ -156,11 +192,10 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
156
192
  !this.context) {
157
193
  return;
158
194
  }
159
- // TODO - KIT-4993: Add temporary deprecation warning.
195
+ this.engine.logger.warn('The `language` property will be removed in the next major version of Atomic (v4). Rather than using this property, set the initial language through the engine configuration when calling `initialize` or `initializeWithEngine`, and update the language as needed using the `updateLocale` method.');
160
196
  this.context.setLanguage(this.language);
161
197
  return this.interfaceController.onLanguageChange();
162
198
  }
163
- // TODO - KIT-4993: Add updateLocale public method.
164
199
  disconnectedCallback() {
165
200
  super.disconnectedCallback();
166
201
  if (typeof this.unsubscribeUrlManager === 'function') {
@@ -210,11 +245,11 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
210
245
  throw error;
211
246
  }
212
247
  }
213
- // TODO - KIT-4993: Adjust.
214
248
  initLanguage() {
215
- if (!this.language) {
216
- this.language = this.context.state.language;
249
+ if (!this.context || this.language) {
250
+ return;
217
251
  }
252
+ this.interfaceController.onLanguageChange(this.context.state.language);
218
253
  }
219
254
  initRequestStatus() {
220
255
  this.searchOrListing =
@@ -256,7 +291,7 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
256
291
  this.i18Initialized,
257
292
  ]);
258
293
  this.initContext();
259
- this.updateLanguage();
294
+ this.updateLanguage(); // TODO - (v4) KIT-4365: Remove.
260
295
  this.bindings = this.getBindings();
261
296
  markParentAsReady(this);
262
297
  this.initRequestStatus();
@@ -266,6 +301,14 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
266
301
  this.initUrlManager();
267
302
  this.initialized = true;
268
303
  }
304
+ isNewLocale(language, country, currency) {
305
+ if (!this.context) {
306
+ return false;
307
+ }
308
+ return ((language && language !== this.context.state.language) ||
309
+ (country && country !== this.context.state.country) ||
310
+ (currency && currency !== this.context.state.currency));
311
+ }
269
312
  // TODO - (v4) KIT-4991: Make private.
270
313
  scrollToTop() {
271
314
  const scrollContainerElement = document.querySelector(this.scrollContainer);
@@ -285,12 +328,6 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
285
328
  history.pushState(null, document.title, `#${newFragment}`);
286
329
  this.bindings.engine.logger.info(`History pushState #${newFragment}`);
287
330
  }
288
- updateMobileBreakpoint() {
289
- const breakpoint = this.querySelector('atomic-commerce-layout')?.mobileBreakpoint;
290
- if (breakpoint) {
291
- this.store.state.mobileBreakpoint = breakpoint;
292
- }
293
- }
294
331
  };
295
332
  AtomicCommerceInterface.styles = [
296
333
  css`:host{display:block;height:inherit;width:inherit;&>slot{height:inherit}}`,
@@ -4,11 +4,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { LitElement, unsafeCSS } from 'lit';
7
+ import { LitElement } from 'lit';
8
8
  import { customElement, property, state } from 'lit/decorators.js';
9
+ import { LayoutStylesController } from "../../common/layout/layout-styles-controller";
10
+ import { watch } from "../../../decorators/watch";
9
11
  import { ChildrenUpdateCompleteMixin } from "../../../mixins/children-update-complete-mixin";
10
12
  import { LightDomMixin } from "../../../mixins/light-dom";
11
- import { randomID } from "../../../utils/utils";
12
13
  import { DEFAULT_MOBILE_BREAKPOINT } from '../../../utils/replace-breakpoint-utils';
13
14
  import styles from './atomic-commerce-layout.tw.css';
14
15
  import { buildCommerceLayout } from './commerce-layout';
@@ -18,8 +19,6 @@ import { buildCommerceLayout } from './commerce-layout';
18
19
  * @cssprop --atomic-layout-max-search-box-input-width: The maximum width that the search box input will take.
19
20
  * @cssprop --atomic-layout-max-search-box-double-suggestions-width: The maximum width that the search box suggestions will take when displaying a double list.
20
21
  * @cssprop --atomic-layout-search-box-left-suggestions-width: The width of the left list when displaying a double list.
21
- *
22
- * @slot default - The default slot for the layout content.
23
22
  */
24
23
  let AtomicCommerceLayout = class AtomicCommerceLayout extends LightDomMixin(ChildrenUpdateCompleteMixin(LitElement)) {
25
24
  constructor() {
@@ -29,15 +28,22 @@ let AtomicCommerceLayout = class AtomicCommerceLayout extends LightDomMixin(Chil
29
28
  * E.g., 800px, 65rem.
30
29
  */
31
30
  this.mobileBreakpoint = DEFAULT_MOBILE_BREAKPOINT;
32
- }
33
- async addStyles() {
34
- await this.getUpdateComplete();
35
- this.injectStyles(unsafeCSS(buildCommerceLayout(this, this.mobileBreakpoint)));
31
+ this.layoutStylesController = new LayoutStylesController(this, buildCommerceLayout, 'atomic-commerce-layout-');
36
32
  }
37
33
  connectedCallback() {
38
34
  super.connectedCallback();
39
- this.id = randomID('atomic-commerce-layout-');
40
- this.addStyles();
35
+ this.emitBreakpointChangeEvent();
36
+ }
37
+ emitBreakpointChangeEvent() {
38
+ this.dispatchEvent(new CustomEvent('atomic-layout-breakpoint-change', {
39
+ detail: { breakpoint: this.mobileBreakpoint },
40
+ bubbles: true,
41
+ composed: true,
42
+ }));
43
+ }
44
+ onMobileBreakpointChange() {
45
+ this.layoutStylesController.updateStyles();
46
+ this.emitBreakpointChangeEvent();
41
47
  }
42
48
  };
43
49
  AtomicCommerceLayout.styles = [styles];
@@ -47,6 +53,9 @@ __decorate([
47
53
  __decorate([
48
54
  property({ type: String, reflect: true, attribute: 'mobile-breakpoint' })
49
55
  ], AtomicCommerceLayout.prototype, "mobileBreakpoint", void 0);
56
+ __decorate([
57
+ watch('mobileBreakpoint')
58
+ ], AtomicCommerceLayout.prototype, "onMobileBreakpointChange", null);
50
59
  AtomicCommerceLayout = __decorate([
51
60
  customElement('atomic-commerce-layout')
52
61
  ], AtomicCommerceLayout);
@@ -37,7 +37,7 @@ let AtomicCommerceQuerySummary = class AtomicCommerceQuerySummary extends LitEle
37
37
  this.listingOrSearchSummary = controller.summary();
38
38
  }
39
39
  render() {
40
- const { firstProduct, firstRequestExecuted, lastProduct, totalNumberOfProducts, hasProducts, hasError, } = this.listingOrSearchSummaryState;
40
+ const { firstProduct, firstRequestExecuted, lastProduct, totalNumberOfProducts, hasProducts, hasError, isLoading, } = this.listingOrSearchSummaryState;
41
41
  const { i18nKey, highlights, ariaLiveMessage } = getProductQuerySummaryI18nParameters({
42
42
  first: firstProduct,
43
43
  last: lastProduct,
@@ -46,7 +46,7 @@ let AtomicCommerceQuerySummary = class AtomicCommerceQuerySummary extends LitEle
46
46
  : '',
47
47
  total: totalNumberOfProducts,
48
48
  i18n: this.bindings.i18n,
49
- isLoading: false,
49
+ isLoading,
50
50
  });
51
51
  this.ariaMessage.message = ariaLiveMessage;
52
52
  return html `${renderQuerySummaryGuard({
@@ -50,6 +50,9 @@ let AtomicCommerceRecommendationInterface = class AtomicCommerceRecommendationIn
50
50
  *
51
51
  */
52
52
  this.iconAssetsPath = './assets';
53
+ // TODO - KIT-4994: Add disableAnalytics property that defaults to false.
54
+ // TODO - KIT-4994: Deprecate in favor of disableAnalytics property.
55
+ // TODO - (v4) KIT-4990: Remove.
53
56
  /**
54
57
  * Whether to enable analytics.
55
58
  */
@@ -104,13 +107,15 @@ let AtomicCommerceRecommendationInterface = class AtomicCommerceRecommendationIn
104
107
  return;
105
108
  }
106
109
  language && this.interfaceController.onLanguageChange(language);
107
- const { setContext } = loadContextActions(this.engine);
108
- this.engine.dispatch(setContext({
109
- ...this.context.state,
110
- ...(language && { language }),
111
- ...(country && { country }),
112
- ...(currency && { currency }),
113
- }));
110
+ if (this.isNewLocale(language, country, currency)) {
111
+ const { setContext } = loadContextActions(this.engine);
112
+ this.engine.dispatch(setContext({
113
+ ...this.context.state,
114
+ ...(language && { language }),
115
+ ...(country && { country }),
116
+ ...(currency && { currency }),
117
+ }));
118
+ }
114
119
  }
115
120
  toggleAnalytics() {
116
121
  this.interfaceController.onAnalyticsChange();
@@ -118,6 +123,7 @@ let AtomicCommerceRecommendationInterface = class AtomicCommerceRecommendationIn
118
123
  updateIconAssetsPath() {
119
124
  this.store.state.iconAssetsPath = this.iconAssetsPath;
120
125
  }
126
+ // TODO - (v4) KIT-4365: Remove.
121
127
  async updateLanguage() {
122
128
  if (!this.interfaceController.engineIsCreated(this.engine) ||
123
129
  !this.language ||
@@ -150,7 +156,7 @@ let AtomicCommerceRecommendationInterface = class AtomicCommerceRecommendationIn
150
156
  this.i18Initialized,
151
157
  ]);
152
158
  this.initContext();
153
- this.language && this.updateLanguage();
159
+ this.updateLanguage();
154
160
  this.bindings = this.getBindings();
155
161
  markParentAsReady(this);
156
162
  this.initLanguage();
@@ -167,9 +173,18 @@ let AtomicCommerceRecommendationInterface = class AtomicCommerceRecommendationIn
167
173
  };
168
174
  }
169
175
  initLanguage() {
170
- if (!this.language) {
171
- this.interfaceController.onLanguageChange(this.context.state.language);
176
+ if (!this.context || this.language) {
177
+ return;
178
+ }
179
+ this.interfaceController.onLanguageChange(this.context.state.language);
180
+ }
181
+ isNewLocale(language, country, currency) {
182
+ if (!this.context) {
183
+ return false;
172
184
  }
185
+ return ((language && language !== this.context.state.language) ||
186
+ (country && country !== this.context.state.country) ||
187
+ (currency && currency !== this.context.state.currency));
173
188
  }
174
189
  };
175
190
  AtomicCommerceRecommendationInterface.styles = [
@@ -20,6 +20,7 @@ import { AriaLiveRegionController } from "../../../utils/accessibility-utils";
20
20
  import { hasKeyboard, isMacOS } from "../../../utils/device-utils";
21
21
  import { SafeStorage, StorageItems, } from "../../../utils/local-storage-utils";
22
22
  import { updateBreakpoints } from "../../../utils/replace-breakpoint-utils";
23
+ import { getDefaultSlotFromHost } from "../../../utils/slot-utils";
23
24
  import { isFocusingOut, once, randomID, spreadProperties, } from '../../../utils/utils';
24
25
  import { renderSearchBoxWrapper } from '../../common/search-box/search-box-wrapper';
25
26
  import { renderSearchBoxTextArea } from '../../common/search-box/search-text-area';
@@ -123,9 +124,6 @@ let AtomicCommerceSearchBox = class AtomicCommerceSearchBox extends LitElement {
123
124
  }
124
125
  connectedCallback() {
125
126
  super.connectedCallback();
126
- if (this.children.length === 0) {
127
- this.replaceChildren(document.createElement('atomic-commerce-search-box-recent-queries'), document.createElement('atomic-commerce-search-box-query-suggestions'));
128
- }
129
127
  this.addEventListener('atomic/searchBoxSuggestion/register', (event) => {
130
128
  const customEvent = event;
131
129
  this.searchBoxSuggestionEventsQueue.push(customEvent);
@@ -492,6 +490,14 @@ let AtomicCommerceSearchBox = class AtomicCommerceSearchBox extends LitElement {
492
490
  ></atomic-suggestion-renderer>
493
491
  `;
494
492
  }
493
+ renderSlotContent() {
494
+ const hasDefaultSlot = !!getDefaultSlotFromHost(this);
495
+ if (hasDefaultSlot) {
496
+ return html `<slot></slot>`;
497
+ }
498
+ return html `<atomic-commerce-search-box-recent-queries></atomic-commerce-search-box-recent-queries>
499
+ <atomic-commerce-search-box-query-suggestions></atomic-commerce-search-box-query-suggestions>`;
500
+ }
495
501
  render() {
496
502
  this.updateBreakpoints();
497
503
  if (!this.suggestionManager.suggestions.length) {
@@ -511,7 +517,7 @@ let AtomicCommerceSearchBox = class AtomicCommerceSearchBox extends LitElement {
511
517
  },
512
518
  },
513
519
  })(html `${this.renderTextBox()}
514
- ${renderSubmitButton({
520
+ ${renderSubmitButton({
515
521
  props: {
516
522
  i18n: this.bindings.i18n,
517
523
  disabled: this.isSearchDisabledForEndUser,
@@ -521,7 +527,8 @@ let AtomicCommerceSearchBox = class AtomicCommerceSearchBox extends LitElement {
521
527
  },
522
528
  },
523
529
  })}
524
- ${this.renderSuggestions()}`)}
530
+ ${this.renderSuggestions()}`)}
531
+ ${this.renderSlotContent()}
525
532
  `;
526
533
  }
527
534
  };
@@ -9,6 +9,7 @@ import { customElement, property, state } from 'lit/decorators.js';
9
9
  import { createRef, ref } from 'lit/directives/ref.js';
10
10
  import { when } from 'lit/directives/when.js';
11
11
  import { booleanConverter } from "../../../converters/boolean-converter.js";
12
+ import { bindings } from "../../../decorators/bindings.js";
12
13
  import { errorGuard } from "../../../decorators/error-guard";
13
14
  import { watch } from "../../../decorators/watch.js";
14
15
  import { withTailwindStyles } from "../../../decorators/with-tailwind-styles.js";
@@ -296,6 +297,7 @@ __decorate([
296
297
  ], AtomicModal.prototype, "watchToggleOpen", null);
297
298
  AtomicModal = __decorate([
298
299
  customElement('atomic-modal'),
300
+ bindings(),
299
301
  withTailwindStyles
300
302
  ], AtomicModal);
301
303
  export { AtomicModal };
@@ -0,0 +1,40 @@
1
+ import { randomID } from "../../../utils/utils";
2
+ /**
3
+ * A reactive controller that manages dynamic layout styles.
4
+ */
5
+ export class LayoutStylesController {
6
+ constructor(host, stylesBuilder, componentPrefix) {
7
+ this.dynamicStyleSheet = null;
8
+ this.host = host;
9
+ this.stylesBuilder = stylesBuilder;
10
+ this.componentPrefix = componentPrefix;
11
+ this.host.addController(this);
12
+ }
13
+ hostConnected() {
14
+ if (!this.host.id) {
15
+ this.host.id = randomID(this.componentPrefix);
16
+ }
17
+ this.host.updateComplete.then(() => this.updateStyles());
18
+ }
19
+ /**
20
+ * Updates the dynamic styles based on the current mobile breakpoint
21
+ */
22
+ updateStyles() {
23
+ const parent = this.host.getRootNode();
24
+ const isDocumentOrShadowRoot = parent instanceof Document || parent instanceof ShadowRoot;
25
+ if (!isDocumentOrShadowRoot) {
26
+ return;
27
+ }
28
+ const newStylesCSS = this.stylesBuilder(this.host, this.host.mobileBreakpoint);
29
+ if (!this.dynamicStyleSheet) {
30
+ this.dynamicStyleSheet = new CSSStyleSheet();
31
+ this.dynamicStyleSheet.replaceSync(newStylesCSS);
32
+ parent.adoptedStyleSheets = [
33
+ ...parent.adoptedStyleSheets,
34
+ this.dynamicStyleSheet,
35
+ ];
36
+ return;
37
+ }
38
+ this.dynamicStyleSheet.replaceSync(newStylesCSS);
39
+ }
40
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A reactive controller that manages mobile breakpoint changes through event communication.
3
+ * This controller listens for 'atomic-layout-breakpoint-change' events and updates a store
4
+ * with the new breakpoint value.
5
+ */
6
+ export class MobileBreakpointController {
7
+ constructor(host, store) {
8
+ this.host = host;
9
+ this.store = store;
10
+ this.eventListener = this.handleBreakpointChange.bind(this);
11
+ this.host.addController(this);
12
+ }
13
+ hostConnected() {
14
+ this.host.addEventListener('atomic-layout-breakpoint-change', this.eventListener);
15
+ }
16
+ hostDisconnected() {
17
+ this.host.removeEventListener('atomic-layout-breakpoint-change', this.eventListener);
18
+ }
19
+ handleBreakpointChange(e) {
20
+ const customEvent = e;
21
+ const newBreakpoint = customEvent.detail?.breakpoint;
22
+ if (newBreakpoint && this.store.state.mobileBreakpoint !== newBreakpoint) {
23
+ this.store.state.mobileBreakpoint = newBreakpoint;
24
+ }
25
+ }
26
+ }
@@ -1,5 +1,4 @@
1
1
  // Auto-generated file
2
2
  export { AtomicQuerySummary } from './atomic-query-summary/atomic-query-summary.js';
3
3
  export { AtomicResultsPerPage } from './atomic-results-per-page/atomic-results-per-page.js';
4
- export { AtomicSearchBoxQuerySuggestions } from './atomic-search-box-query-suggestions/atomic-search-box-query-suggestions.js';
5
4
  export { AtomicSearchLayout } from './atomic-search-layout/atomic-search-layout.js';
@@ -2,6 +2,5 @@
2
2
  export default {
3
3
  'atomic-query-summary': async () => await import('./atomic-query-summary/atomic-query-summary.js'),
4
4
  'atomic-results-per-page': async () => await import('./atomic-results-per-page/atomic-results-per-page.js'),
5
- 'atomic-search-box-query-suggestions': async () => await import('./atomic-search-box-query-suggestions/atomic-search-box-query-suggestions.js'),
6
5
  'atomic-search-layout': async () => await import('./atomic-search-layout/atomic-search-layout.js'),
7
6
  };
@@ -3,7 +3,7 @@ function getWindow() {
3
3
  }
4
4
  export function getAtomicEnvironment(headlessVersion) {
5
5
  return {
6
- version: "3.33.8-pre.f62f2d7753",
6
+ version: "3.33.8-pre.f68a2ba413",
7
7
  headlessVersion,
8
8
  };
9
9
  }
@@ -1 +1 @@
1
- {"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;;;;;;;SAYgB,cAAc,CAAoB,OAAgB;IAChE,OAAO,WAAW,CAAI,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACnD;;MCHa,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,WAAmB,EAAE,UAAkB;QACjD,KAAK,CACH,QAAQ,WAAW,sCAAsC,UAAU,YAAY,CAChF,CAAC;KACH;;;ACfH,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;SAIpC,gBAAgB,CAAI,OAAgB,EAAE,UAAkB;IACtE,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM;QACpC,MAAM,KAAK,GAAG,gBAAgB,CAC5B,oBAAoB,EACpB,CAAC,IAAO;YACN,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;SACtB,CACF,CAAC;QACF,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE;YACjC,MAAM,CACJ,IAAI,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CACnE,CAAC;SACH;KACF,CAAC,CAAC;AACL;;ACoDA;;;;;;;;;;SAUgB,mBAAmB,CAAoB,OAAgB;IACrE,OAAO,gBAAgB,CAAI,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACxD;;;;","names":[],"sources":["src/components/commerce/product-template-component-utils/stencil-product-template-decorators.tsx","src/components/common/item-list/context/item-context-controller.ts","src/components/common/item-list/fetch-item-context.ts","src/decorators/commerce/product-template-decorators.ts"],"sourcesContent":["import {Product} from '@coveo/headless/commerce';\nimport {itemContext} from '../../common/item-list/stencil-item-decorators';\n\n/**\n * Retrieves `Product` on a rendered `atomic-product`.\n *\n * This method is useful for building custom product template elements, see [Create a Product List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-product-template-component-example) for more information.\n *\n * You should use the method in the [connectedCallback lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).\n *\n * @param element - The element that the event is dispatched to, which must be the child of a rendered \"atomic-product\".\n * @returns A promise that resolves on initialization of the parent \"atomic-product\" element, or rejects when there is no parent \"atomic-product\" element.\n *\n * @deprecated should only be used for Stencil components. For Lit components, use `fetchProductContext` from \\@/src/decorators/commerce/product-template-decorators.ts\n */\nexport function productContext<T extends Product>(element: Element) {\n return itemContext<T>(element, 'atomic-product');\n}\n","import type {LitElement, ReactiveController, ReactiveControllerHost} from 'lit';\nimport type {InitializableComponent} from '@/src/decorators/types.js';\nimport {buildCustomEvent} from '@/src/utils/event-utils';\n\ntype LitElementWithError = Omit<\n Pick<InitializableComponent, 'error'>,\n 'error'\n> &\n LitElement & {\n error: Error | null;\n };\n\nconst itemContextEventName = 'atomic/resolveResult';\n\nexport class MissingParentError extends Error {\n constructor(elementName: string, parentName: string) {\n super(\n `The \"${elementName}\" element must be the child of an \"${parentName}\" element.`\n );\n }\n}\n\nfunction extractFolded<T = Record<string, unknown>>(\n item: Record<string, unknown>,\n returnFolded: boolean\n): T {\n if (returnFolded) {\n if ('children' in item) {\n return item as T;\n } else {\n return {children: [], result: item} as T;\n }\n }\n\n if ('children' in item && 'result' in item) {\n return item.result as T;\n }\n return item as T;\n}\n\n/**\n * A reactive controller that manages item context data from parent components.\n * Handles fetching item data via custom events and manages error states.\n */\nexport class ItemContextController<T = Record<string, unknown>>\n implements ReactiveController\n{\n private host: ReactiveControllerHost & LitElementWithError;\n private parentName: string;\n private folded: boolean;\n private _item: T | null = null;\n private _error: MissingParentError | null = null;\n\n constructor(\n host: ReactiveControllerHost & LitElementWithError,\n options: {parentName?: string; folded?: boolean} = {}\n ) {\n this.host = host;\n this.parentName = options.parentName ?? 'atomic-result';\n this.folded = options.folded ?? false;\n host.addController(this);\n }\n\n get item(): T | null {\n return this._error ? null : this._item;\n }\n\n get error(): MissingParentError | null {\n return this._error;\n }\n\n get hasError(): boolean {\n return this._error !== null;\n }\n\n hostConnected(): void {\n this._resolveItemContext();\n }\n\n private _resolveItemContext(): void {\n const event = buildCustomEvent(\n itemContextEventName,\n (item: Record<string, unknown>) => {\n this._item = extractFolded<T>(item, this.folded);\n this._error = null;\n this.host.error = null;\n this.host.requestUpdate();\n }\n );\n\n const canceled = this.host.dispatchEvent(event);\n if (canceled) {\n const elementName = (this.host as Element).nodeName.toLowerCase();\n this._error = new MissingParentError(elementName, this.parentName);\n this._item = null;\n this.host.error = this._error;\n this.host.requestUpdate();\n }\n }\n}\n\ntype ItemContextEventHandler<T> = (item: T) => void;\nexport type ItemContextEvent<T> = CustomEvent<ItemContextEventHandler<T>>;\n","import {closest} from '../../../utils/dom-utils.js';\nimport {buildCustomEvent} from '../../../utils/event-utils.js';\nimport {MissingParentError} from './context/item-context-controller.js';\n\nconst itemContextEventName = 'atomic/resolveResult';\n\ntype ItemContextEventHandler<T> = (item: T) => void;\n\nexport function fetchItemContext<T>(element: Element, parentName: string) {\n return new Promise<T>((resolve, reject) => {\n const event = buildCustomEvent<ItemContextEventHandler<T>>(\n itemContextEventName,\n (item: T) => {\n return resolve(item);\n }\n );\n element.dispatchEvent(event);\n\n if (!closest(element, parentName)) {\n reject(\n new MissingParentError(element.nodeName.toLowerCase(), parentName)\n );\n }\n });\n}\n","import type {InteractiveProduct, Product} from '@coveo/headless/commerce';\nimport type {LitElement} from 'lit';\nimport {\n InteractiveItemContextController,\n type InteractiveItemContextEvent,\n} from '@/src/components/common/item-list/context/interactive-item-context-controller';\nimport {\n ItemContextController,\n type ItemContextEvent,\n} from '@/src/components/common/item-list/context/item-context-controller';\nimport {fetchItemContext} from '@/src/components/common/item-list/fetch-item-context';\n\n/**\n * Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing product context in product template components.\n *\n * @param host - The Lit component instance\n * @param options - Configuration options\n * @returns ItemContextController instance configured for atomic-product\n *\n * @example\n * ```typescript\n * @customElement('my-product-component')\n * export class MyProductComponent extends LitElement {\n * private productController = createProductContextController(this);\n *\n * @state() product!: Product;\n *\n * render() {\n * this.product = this.productController.item;\n * return html`<div>${this.product?.ec_name}</div>`;\n * }\n * }\n * ```\n */\nexport function createProductContextController(\n host: LitElement & {error: Error | null},\n options: {folded?: boolean} = {}\n): ItemContextController<Product> {\n return new ItemContextController<Product>(host, {\n parentName: 'atomic-product',\n folded: options.folded ?? false,\n });\n}\n\n/**\n * Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing interactive product context in product template components.\n *\n * @param host - The Lit component instance\n * @returns InteractiveItemContextController instance\n *\n * @example\n * ```typescript\n * @customElement('my-interactive-product-component')\n * export class MyInteractiveProductComponent extends LitElement {\n * private interactiveProductController = createInteractiveProductContextController(this);\n *\n * @state() product!: Product;\n *\n * render() {\n * this.product = this.interactiveProductController.interactiveItem;\n * return html`<div>${this.product?.ec_name}</div>`;\n * }\n * }\n * ```\n */\nexport function createInteractiveProductContextController(\n host: LitElement & {error: Error}\n): InteractiveItemContextController<InteractiveProduct> {\n return new InteractiveItemContextController<InteractiveProduct>(host);\n}\n\nexport type ProductContextEvent<T = Product> = ItemContextEvent<T>;\nexport type InteractiveProductContextEvent<\n T extends InteractiveProduct = InteractiveProduct,\n> = InteractiveItemContextEvent<T>;\n\n/**\n * Retrieves `Product` on a rendered `atomic-product`.\n *\n * This utility function is useful for building custom product template elements, see [Create a Product List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-product-template-component-example) for more information.\n *\n * You should use the utility function in the [`connectedCallback` lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).\n *\n * @param element - The element that the event is dispatched to, which must be the child of a rendered `atomic-product`.\n * @returns A promise that resolves on initialization of the parent `atomic-product` element, or rejects when there is no parent `atomic-product` element.\n */\nexport function fetchProductContext<T extends Product>(element: Element) {\n return fetchItemContext<T>(element, 'atomic-product');\n}\n"],"version":3}
1
+ {"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;;;;;;;SAYgB,cAAc,CAAoB,OAAgB;IAChE,OAAO,WAAW,CAAI,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACnD;;MCHa,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,WAAmB,EAAE,UAAkB;QACjD,KAAK,CACH,QAAQ,WAAW,sCAAsC,UAAU,YAAY,CAChF,CAAC;KACH;;;ACfH,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;SAIpC,gBAAgB,CAAI,OAAgB,EAAE,UAAkB;IACtE,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM;QACpC,MAAM,KAAK,GAAG,gBAAgB,CAC5B,oBAAoB,EACpB,CAAC,IAAO;YACN,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;SACtB,CACF,CAAC;QACF,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE;YACjC,MAAM,CACJ,IAAI,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CACnE,CAAC;SACH;KACF,CAAC,CAAC;AACL;;ACoDA;;;;;;;;;;SAUgB,mBAAmB,CAAoB,OAAgB;IACrE,OAAO,gBAAgB,CAAI,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACxD;;;;","names":[],"sources":["src/components/commerce/product-template-component-utils/stencil-product-template-decorators.tsx","src/components/common/item-list/context/item-context-controller.ts","src/components/common/item-list/fetch-item-context.ts","src/decorators/commerce/product-template-decorators.ts"],"sourcesContent":["import {Product} from '@coveo/headless/commerce';\nimport {itemContext} from '../../common/item-list/stencil-item-decorators';\n\n/**\n * Retrieves `Product` on a rendered `atomic-product`.\n *\n * This method is useful for building custom product template elements, see [Create a Product List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-product-template-component-example) for more information.\n *\n * You should use the method in the [connectedCallback lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).\n *\n * @param element - The element that the event is dispatched to, which must be the child of a rendered \"atomic-product\".\n * @returns A promise that resolves on initialization of the parent \"atomic-product\" element, or rejects when there is no parent \"atomic-product\" element.\n *\n * @deprecated should only be used for Stencil components. For Lit components, use `fetchProductContext` from \\@/src/decorators/commerce/product-template-decorators.ts\n */\nexport function productContext<T extends Product>(element: Element) {\n return itemContext<T>(element, 'atomic-product');\n}\n","import type {LitElement, ReactiveController, ReactiveControllerHost} from 'lit';\nimport type {InitializableComponent} from '@/src/decorators/types.js';\nimport {buildCustomEvent} from '@/src/utils/event-utils';\n\ntype LitElementWithError = Omit<\n Pick<InitializableComponent, 'error'>,\n 'error'\n> &\n LitElement & {\n error: Error | null;\n };\n\nconst itemContextEventName = 'atomic/resolveResult';\n\nexport class MissingParentError extends Error {\n constructor(elementName: string, parentName: string) {\n super(\n `The \"${elementName}\" element must be the child of an \"${parentName}\" element.`\n );\n }\n}\n\nfunction extractFolded<T = Record<string, unknown>>(\n item: Record<string, unknown>,\n returnFolded: boolean\n): T {\n if (returnFolded) {\n if ('children' in item) {\n return item as T;\n } else {\n return {children: [], result: item} as T;\n }\n }\n\n if ('children' in item && 'result' in item) {\n return item.result as T;\n }\n return item as T;\n}\n\n/**\n * A reactive controller that manages item context data from parent components.\n * Handles fetching item data via custom events and manages error states.\n */\nexport class ItemContextController<T = Record<string, unknown>>\n implements ReactiveController\n{\n private host: ReactiveControllerHost & LitElementWithError;\n private parentName: string;\n private folded: boolean;\n private _item: T | null = null;\n private _error: MissingParentError | null = null;\n\n constructor(\n host: ReactiveControllerHost & LitElementWithError,\n options: {parentName?: string; folded?: boolean} = {}\n ) {\n this.host = host;\n this.parentName = options.parentName ?? 'atomic-result';\n this.folded = options.folded ?? false;\n host.addController(this);\n }\n\n get item(): T | null {\n return this._error ? null : this._item;\n }\n\n get error(): MissingParentError | null {\n return this._error;\n }\n\n get hasError(): boolean {\n return this._error !== null;\n }\n\n hostConnected(): void {\n this._resolveItemContext();\n }\n\n private _resolveItemContext(): void {\n const event = buildCustomEvent(\n itemContextEventName,\n (item: Record<string, unknown>) => {\n this._item = extractFolded<T>(item, this.folded);\n this._error = null;\n this.host.error = null;\n this.host.requestUpdate();\n }\n );\n\n const canceled = this.host.dispatchEvent(event);\n if (canceled) {\n const elementName = (this.host as Element).nodeName.toLowerCase();\n this._error = new MissingParentError(elementName, this.parentName);\n this._item = null;\n this.host.error = this._error;\n this.host.requestUpdate();\n }\n }\n}\n\ntype ItemContextEventHandler<T> = (item: T) => void;\nexport type ItemContextEvent<T> = CustomEvent<ItemContextEventHandler<T>>;\n","import {closest} from '../../../utils/dom-utils.js';\nimport {buildCustomEvent} from '../../../utils/event-utils.js';\nimport {MissingParentError} from './context/item-context-controller.js';\n\nconst itemContextEventName = 'atomic/resolveResult';\n\ntype ItemContextEventHandler<T> = (item: T) => void;\n\nexport function fetchItemContext<T>(element: Element, parentName: string) {\n return new Promise<T>((resolve, reject) => {\n const event = buildCustomEvent<ItemContextEventHandler<T>>(\n itemContextEventName,\n (item: T) => {\n return resolve(item);\n }\n );\n element.dispatchEvent(event);\n\n if (!closest(element, parentName)) {\n reject(\n new MissingParentError(element.nodeName.toLowerCase(), parentName)\n );\n }\n });\n}\n","import type {InteractiveProduct, Product} from '@coveo/headless/commerce';\nimport type {LitElement} from 'lit';\nimport {\n InteractiveItemContextController,\n type InteractiveItemContextEvent,\n} from '@/src/components/common/item-list/context/interactive-item-context-controller';\nimport {\n ItemContextController,\n type ItemContextEvent,\n} from '@/src/components/common/item-list/context/item-context-controller';\nimport {fetchItemContext} from '@/src/components/common/item-list/fetch-item-context';\n\n/**\n * Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing product context in product template components.\n *\n * @param host - The Lit component instance\n * @param options - Configuration options\n * @returns ItemContextController instance configured for atomic-product\n *\n * @example\n * ```typescript\n * @customElement('my-product-component')\n * export class MyProductComponent extends LitElement {\n * private productController = createProductContextController(this);\n *\n * @state() product!: Product;\n *\n * render() {\n * this.product = this.productController.item;\n * return html`<div>${this.product?.ec_name}</div>`;\n * }\n * }\n * ```\n */\nexport function createProductContextController(\n host: LitElement & {error: Error | null},\n options: {folded?: boolean} = {}\n): ItemContextController<Product> {\n return new ItemContextController<Product>(host, {\n parentName: 'atomic-product',\n folded: options.folded ?? false,\n });\n}\n\n/**\n * Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing interactive product context in product template components.\n *\n * @param host - The Lit component instance\n * @returns InteractiveItemContextController instance\n *\n * @example\n * ```typescript\n * @customElement('my-interactive-product-component')\n * export class MyInteractiveProductComponent extends LitElement {\n * private interactiveProductController = createInteractiveProductContextController(this);\n *\n * @state() product!: Product;\n *\n * render() {\n * this.product = this.interactiveProductController.interactiveItem;\n * return html`<div>${this.product?.ec_name}</div>`;\n * }\n * }\n * ```\n */\nexport function createInteractiveProductContextController(\n host: LitElement & {error: Error}\n): InteractiveItemContextController<InteractiveProduct> {\n return new InteractiveItemContextController<InteractiveProduct>(host);\n}\n\nexport type ProductContextEvent<T = Product> = ItemContextEvent<T>;\nexport type InteractiveProductContextEvent<\n T extends InteractiveProduct = InteractiveProduct,\n> = InteractiveItemContextEvent<T>;\n\n/**\n * Retrieves `Product` on a rendered `atomic-product`.\n *\n * This utility function is useful for building custom product template elements, see [Create a Product List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-product-template-component-example) for more information.\n *\n * You should use the utility function in the [`connectedCallback` lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).\n *\n * @param element - The element that the event is dispatched to, which must be the child of a rendered `atomic-product`.\n * @returns A promise that resolves on initialization of the parent `atomic-product` element, or rejects when there is no parent `atomic-product` element.\n */\nexport function fetchProductContext<T extends Product>(element: Element) {\n return fetchItemContext<T>(element, 'atomic-product');\n}\n"],"version":3}
@@ -0,0 +1,33 @@
1
+ import { h } from '@stencil/core/internal/client';
2
+ import { e as encodeForDomAttribute } from './string-utils.js';
3
+
4
+ const getPartialSearchBoxSuggestionElement = (suggestion, i18n) => {
5
+ return {
6
+ part: 'query-suggestion-item',
7
+ key: `qs-${encodeForDomAttribute(suggestion.rawValue)}`,
8
+ query: suggestion.rawValue,
9
+ ariaLabel: i18n.t('query-suggestion-label', {
10
+ query: suggestion.rawValue,
11
+ interpolation: { escapeValue: false },
12
+ }),
13
+ };
14
+ };
15
+ const QuerySuggestionContainer = (_, children) => {
16
+ return (h("div", { part: "query-suggestion-content", class: "flex items-center" }, children));
17
+ };
18
+ const QuerySuggestionIcon = ({ icon, hasSuggestion }) => {
19
+ if (!hasSuggestion) {
20
+ return;
21
+ }
22
+ return (h("atomic-icon", { part: "query-suggestion-icon", icon: icon, class: "mr-2 h-4 w-4 shrink-0" }));
23
+ };
24
+ const QuerySuggestionText = ({ suggestion, hasQuery }) => {
25
+ if (hasQuery) {
26
+ return (h("span", { part: "query-suggestion-text", class: "line-clamp-2 break-all", innerHTML: suggestion.highlightedValue }));
27
+ }
28
+ return (h("span", { part: "query-suggestion-text", class: "line-clamp-2 break-all" }, suggestion.rawValue));
29
+ };
30
+
31
+ export { QuerySuggestionContainer as Q, QuerySuggestionIcon as a, QuerySuggestionText as b, getPartialSearchBoxSuggestionElement as g };
32
+
33
+ //# sourceMappingURL=stencil-query-suggestions.js.map
@@ -0,0 +1 @@
1
+ {"file":"stencil-query-suggestions.js","mappings":";;;MAUa,oCAAoC,GAAG,CAClD,UAAsB,EACtB,IAAU;IAEV,OAAO;QACL,IAAI,EAAE,uBAAuB;QAC7B,GAAG,EAAE,MAAM,qBAAqB,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QACvD,KAAK,EAAE,UAAU,CAAC,QAAQ;QAC1B,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,wBAAwB,EAAE;YAC1C,KAAK,EAAE,UAAU,CAAC,QAAQ;YAC1B,aAAa,EAAE,EAAC,WAAW,EAAE,KAAK,EAAC;SACpC,CAAC;KACH,CAAC;AACJ,EAAE;MAEW,wBAAwB,GAAwB,CAAC,CAAC,EAAE,QAAQ;IACvE,QACE,WAAK,IAAI,EAAC,0BAA0B,EAAC,KAAK,EAAC,mBAAmB,IAC3D,QAAQ,CACL,EACN;AACJ,EAAE;MAOW,mBAAmB,GAE5B,CAAC,EAAC,IAAI,EAAE,aAAa,EAAC;IACxB,IAAI,CAAC,aAAa,EAAE;QAClB,OAAO;KACR;IAED,QACE,mBACE,IAAI,EAAC,uBAAuB,EAC5B,IAAI,EAAE,IAAI,EACV,KAAK,EAAC,uBAAuB,GAChB,EACf;AACJ,EAAE;MAOW,mBAAmB,GAE5B,CAAC,EAAC,UAAU,EAAE,QAAQ,EAAC;IACzB,IAAI,QAAQ,EAAE;QACZ,QACE,YACE,IAAI,EAAC,uBAAuB,EAC5B,KAAK,EAAC,wBAAwB,EAC9B,SAAS,EAAE,UAAU,CAAC,gBAAgB,GAChC,EACR;KACH;IAED,QACE,YAAM,IAAI,EAAC,uBAAuB,EAAC,KAAK,EAAC,wBAAwB,IAC9D,UAAU,CAAC,QAAQ,CACf,EACP;AACJ;;;;","names":[],"sources":["src/components/common/suggestions/stencil-query-suggestions.tsx"],"sourcesContent":["import {FunctionalComponent, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {encodeForDomAttribute} from '../../../utils/string-utils.js';\nimport {SearchBoxSuggestionElement} from './suggestions-types.js';\n\ninterface Suggestion {\n highlightedValue: string;\n rawValue: string;\n}\n\nexport const getPartialSearchBoxSuggestionElement = (\n suggestion: Suggestion,\n i18n: i18n\n): Pick<SearchBoxSuggestionElement, 'ariaLabel' | 'key' | 'query' | 'part'> => {\n return {\n part: 'query-suggestion-item',\n key: `qs-${encodeForDomAttribute(suggestion.rawValue)}`,\n query: suggestion.rawValue,\n ariaLabel: i18n.t('query-suggestion-label', {\n query: suggestion.rawValue,\n interpolation: {escapeValue: false},\n }),\n };\n};\n\nexport const QuerySuggestionContainer: FunctionalComponent = (_, children) => {\n return (\n <div part=\"query-suggestion-content\" class=\"flex items-center\">\n {children}\n </div>\n );\n};\n\ninterface QuerySuggestionIconProps {\n icon: string;\n hasSuggestion: boolean;\n}\n\nexport const QuerySuggestionIcon: FunctionalComponent<\n QuerySuggestionIconProps\n> = ({icon, hasSuggestion}) => {\n if (!hasSuggestion) {\n return;\n }\n\n return (\n <atomic-icon\n part=\"query-suggestion-icon\"\n icon={icon}\n class=\"mr-2 h-4 w-4 shrink-0\"\n ></atomic-icon>\n );\n};\n\ninterface QuerySuggestionTextProps {\n suggestion: Suggestion;\n hasQuery: boolean;\n}\n\nexport const QuerySuggestionText: FunctionalComponent<\n QuerySuggestionTextProps\n> = ({suggestion, hasQuery}) => {\n if (hasQuery) {\n return (\n <span\n part=\"query-suggestion-text\"\n class=\"line-clamp-2 break-all\"\n innerHTML={suggestion.highlightedValue}\n ></span>\n );\n }\n\n return (\n <span part=\"query-suggestion-text\" class=\"line-clamp-2 break-all\">\n {suggestion.rawValue}\n </span>\n );\n};\n"],"version":3}