@sonic-equipment/ui 1.1.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (497) hide show
  1. package/dist/algolia/algolia-hits-provider.js +4 -1
  2. package/dist/algolia/algolia-insights-provider.js +3 -3
  3. package/dist/algolia/algolia-provider.d.ts +4 -1
  4. package/dist/algolia/algolia-provider.js +6 -3
  5. package/dist/algolia/algolia-search-provider.js +1 -1
  6. package/dist/algolia/algolia-searchclient-reserved-slots.d.ts +25 -0
  7. package/dist/algolia/algolia-searchclient-reserved-slots.js +67 -0
  8. package/dist/algolia/use-algolia-hits.d.ts +5 -2
  9. package/dist/algolia/use-algolia-hits.js +9 -5
  10. package/dist/algolia/use-algolia-insights.js +2 -2
  11. package/dist/algolia/use-algolia-search.js +2 -2
  12. package/dist/badges/tag/tag.d.ts +2 -1
  13. package/dist/badges/tag/tag.js +3 -2
  14. package/dist/base.css +28 -1
  15. package/dist/breadcrumbs/breadcrumb.d.ts +1 -1
  16. package/dist/breadcrumbs/breadcrumb.js +2 -2
  17. package/dist/buttons/button/button.d.ts +2 -1
  18. package/dist/buttons/button/button.js +10 -2
  19. package/dist/buttons/icon-button/icon-button.d.ts +8 -1
  20. package/dist/buttons/icon-button/icon-button.js +4 -5
  21. package/dist/buttons/invoice-download-buttons/invoice-download-buttons.d.ts +8 -0
  22. package/dist/buttons/invoice-download-buttons/invoice-download-buttons.js +29 -0
  23. package/dist/buttons/invoice-download-buttons/invoice-download-buttons.module.css.js +3 -0
  24. package/dist/buttons/invoice-download-buttons/invoice-download-url.d.ts +5 -0
  25. package/dist/buttons/invoice-download-buttons/invoice-download-url.js +9 -0
  26. package/dist/buttons/invoice-download-buttons/invoice-download-url.test.d.ts +1 -0
  27. package/dist/cards/data-card/data-card.js +1 -1
  28. package/dist/cards/product-card/product-card.js +2 -1
  29. package/dist/cards/product-card/product-card.module.css.js +1 -1
  30. package/dist/cards/table-card/table-card.d.ts +6 -1
  31. package/dist/cards/table-card/table-card.js +3 -4
  32. package/dist/carousel/card-carousel/card-carousel.d.ts +3 -1
  33. package/dist/carousel/card-carousel/card-carousel.js +5 -3
  34. package/dist/carousel/card-carousel/card-carousel.module.css.js +1 -1
  35. package/dist/carousel/carousel-navigation-button.d.ts +3 -1
  36. package/dist/carousel/carousel-navigation-button.js +2 -3
  37. package/dist/carousel/carousel.js +1 -1
  38. package/dist/carousel/usp-carousel/product-usp-carousel-slide.js +1 -1
  39. package/dist/carousel/usp-carousel/usp-carousel.d.ts +0 -1
  40. package/dist/cart-totals/cart-totals-summary.js +1 -1
  41. package/dist/cart-totals/cart-totals.d.ts +3 -1
  42. package/dist/cart-totals/cart-totals.js +9 -3
  43. package/dist/cart-totals/cart-totals.module.css.js +1 -1
  44. package/dist/client-case-banner/client-case-banner.d.ts +16 -0
  45. package/dist/client-case-banner/client-case-banner.js +13 -0
  46. package/dist/client-case-banner/client-case-banner.module.css.js +3 -0
  47. package/dist/collapsables/accordion/accordion-item.js +1 -1
  48. package/dist/collapsables/cascading-component/cascading-component-container-provider.js +1 -1
  49. package/dist/collapsables/cascading-component/use-cascading-component-container.js +2 -2
  50. package/dist/collapsables/collapsable/collapsable.d.ts +12 -0
  51. package/dist/collapsables/collapsable/collapsable.js +31 -0
  52. package/dist/collapsables/collapsable/collapsable.module.css.js +3 -0
  53. package/dist/collapsables/unmounter/unmounter.js +3 -3
  54. package/dist/cookies/cookie-provider.js +1 -1
  55. package/dist/cookies/use-cookie.js +2 -2
  56. package/dist/country-language-selection-list/country-language-selection-list.js +1 -1
  57. package/dist/country-language-selection-list/country-language-selection-list.module.css.js +1 -1
  58. package/dist/country-language-selector/connected-country-language-selector.d.ts +1 -2
  59. package/dist/country-language-selector/connected-country-language-selector.js +2 -2
  60. package/dist/country-language-selector/country-language-selector.d.ts +1 -2
  61. package/dist/country-language-selector/country-language-selector.js +12 -19
  62. package/dist/country-language-selector/country-language-selector.module.css.js +1 -1
  63. package/dist/country-language-selector/fixtures/fixtures.d.ts +13 -0
  64. package/dist/country-language-selector-button/country-language-selector-button.stories.d.ts +13 -0
  65. package/dist/display/details/details.d.ts +2 -1
  66. package/dist/display/details/details.js +2 -2
  67. package/dist/display/product-sku/product-sku.js +3 -1
  68. package/dist/exports.d.ts +67 -21
  69. package/dist/filters/pagination/pagination.d.ts +2 -1
  70. package/dist/filters/pagination/pagination.js +3 -2
  71. package/dist/fonts.css +58 -56
  72. package/dist/footer/fixtures/fixtures.d.ts +3 -0
  73. package/dist/footer/footer.js +3 -2
  74. package/dist/footer/footer.module.css.js +1 -1
  75. package/dist/forms/elements/input/input.js +4 -6
  76. package/dist/forms/elements/range-slider/range-slider.d.ts +18 -0
  77. package/dist/forms/elements/range-slider/range-slider.js +31 -0
  78. package/dist/forms/elements/range-slider/range-slider.module.css.js +3 -0
  79. package/dist/global-search/global-search.d.ts +6 -1
  80. package/dist/global-search/global-search.js +3 -2
  81. package/dist/global-search/search-highlight/highlight.d.ts +7 -7
  82. package/dist/global-search/search-highlight/highlight.js +9 -9
  83. package/dist/global-search/search-input/connected-search-input.js +4 -1
  84. package/dist/global-search/search-result-panel/panel-content.d.ts +3 -1
  85. package/dist/global-search/search-result-panel/panel-content.js +2 -2
  86. package/dist/global-search/search-result-panel/search-result-panel.d.ts +3 -1
  87. package/dist/global-search/search-result-panel/search-result-panel.js +2 -2
  88. package/dist/global-search/search-result-panel/sections/no-search-results.js +1 -3
  89. package/dist/global-search/search-result-panel/sections/no-search.d.ts +2 -1
  90. package/dist/global-search/search-result-panel/sections/no-search.js +7 -14
  91. package/dist/global-search/search-result-panel/sections/search-content.module.css.js +1 -1
  92. package/dist/global-search/search-result-panel/sections/section-container.js +2 -2
  93. package/dist/global-search/search-result-panel/sections/with-results.js +6 -6
  94. package/dist/header/drawers/desktop-navigation-drawer.js +2 -1
  95. package/dist/header/drawers/mobile-navigation-drawer.js +2 -1
  96. package/dist/header/drawers/search-drawer.d.ts +3 -1
  97. package/dist/header/drawers/search-drawer.js +3 -2
  98. package/dist/header/drawers/search-drawer.module.css.js +3 -0
  99. package/dist/header/fixtures/fixtures.d.ts +4 -0
  100. package/dist/header/header-layout/header-layout.d.ts +1 -1
  101. package/dist/header/header-layout/header-layout.js +2 -3
  102. package/dist/header/header-layout/header-layout.module.css.js +1 -1
  103. package/dist/header/header.d.ts +3 -2
  104. package/dist/header/header.js +3 -2
  105. package/dist/header/header.module.css.js +1 -1
  106. package/dist/hubspot-form/hubspot-form.d.ts +41 -0
  107. package/dist/hubspot-form/hubspot-form.js +125 -0
  108. package/dist/hubspot-form/hubspot-form.module.css.js +3 -0
  109. package/dist/icons/index.d.ts +86 -0
  110. package/dist/icons/index.js +86 -0
  111. package/dist/icons/other/media-captionsoff-icon.d.ts +1 -0
  112. package/dist/icons/other/media-captionsoff-icon.js +7 -0
  113. package/dist/icons/other/media-captionson-icon.d.ts +1 -0
  114. package/dist/icons/other/media-captionson-icon.js +7 -0
  115. package/dist/icons/other/media-chapters-icon.d.ts +1 -0
  116. package/dist/icons/other/media-chapters-icon.js +7 -0
  117. package/dist/icons/other/media-enterfullscreen-icon.d.ts +1 -0
  118. package/dist/icons/other/media-enterfullscreen-icon.js +7 -0
  119. package/dist/icons/other/media-exitfullscreen-icon.d.ts +1 -0
  120. package/dist/icons/other/media-exitfullscreen-icon.js +7 -0
  121. package/dist/icons/other/media-pause-icon.d.ts +1 -0
  122. package/dist/icons/other/media-pause-icon.js +7 -0
  123. package/dist/icons/other/media-play-icon.d.ts +1 -0
  124. package/dist/icons/other/media-play-icon.js +7 -0
  125. package/dist/icons/other/media-seekbackwards-icon.d.ts +1 -0
  126. package/dist/icons/other/media-seekbackwards-icon.js +7 -0
  127. package/dist/icons/other/media-seekforwards-icon.d.ts +1 -0
  128. package/dist/icons/other/media-seekforwards-icon.js +7 -0
  129. package/dist/icons/other/media-subsoff-icon.d.ts +1 -0
  130. package/dist/icons/other/media-subsoff-icon.js +7 -0
  131. package/dist/icons/other/media-subson-icon.d.ts +1 -0
  132. package/dist/icons/other/media-subson-icon.js +7 -0
  133. package/dist/icons/other/media-volumefull-icon.d.ts +1 -0
  134. package/dist/icons/other/media-volumefull-icon.js +7 -0
  135. package/dist/icons/other/media-volumelow-icon.d.ts +1 -0
  136. package/dist/icons/other/media-volumelow-icon.js +7 -0
  137. package/dist/icons/other/media-volumemedium-icon.d.ts +1 -0
  138. package/dist/icons/other/media-volumemedium-icon.js +7 -0
  139. package/dist/icons/other/media-volumemuted-icon.d.ts +1 -0
  140. package/dist/icons/other/media-volumemuted-icon.js +7 -0
  141. package/dist/icons/solid/solid-enterfullscreen-icon.d.ts +1 -0
  142. package/dist/icons/solid/solid-exitfullscreen-icon.d.ts +1 -0
  143. package/dist/icons/solid/solid-facebook-icon.js +7 -0
  144. package/dist/icons/solid/solid-instagram-icon.js +7 -0
  145. package/dist/icons/solid/solid-link-icon.js +7 -0
  146. package/dist/icons/solid/solid-linkedin-icon.js +7 -0
  147. package/dist/icons/solid/solid-tiktok-icon.js +7 -0
  148. package/dist/icons/solid/solid-youtube-icon.js +7 -0
  149. package/dist/icons/stroke/stroke-business-icon.js +7 -0
  150. package/dist/icons/stroke/stroke-captions-icon.d.ts +1 -0
  151. package/dist/icons/stroke/stroke-captions-icon.js +7 -0
  152. package/dist/icons/stroke/stroke-efficiency-icon.js +7 -0
  153. package/dist/icons/stroke/stroke-fallback-icon.js +7 -0
  154. package/dist/icons/stroke/stroke-happy-icon.js +7 -0
  155. package/dist/icons/stroke/stroke-innovate-icon.js +7 -0
  156. package/dist/icons/stroke/stroke-list-icon.d.ts +1 -0
  157. package/dist/icons/stroke/stroke-list-icon.js +7 -0
  158. package/dist/icons/stroke/stroke-modular-icon.js +7 -0
  159. package/dist/icons/stroke/stroke-okay-icon.js +7 -0
  160. package/dist/icons/stroke/stroke-package-icon.js +7 -0
  161. package/dist/icons/stroke/stroke-proactive-icon.js +7 -0
  162. package/dist/icons/stroke/stroke-productivity-icon.js +7 -0
  163. package/dist/icons/stroke/stroke-rating-icon.js +7 -0
  164. package/dist/icons/stroke/stroke-salecategory-icon.js +7 -0
  165. package/dist/icons/stroke/stroke-style-icon.js +7 -0
  166. package/dist/icons/stroke/stroke-support-icon.js +7 -0
  167. package/dist/icons/stroke/stroke-thumbsup-icon.js +7 -0
  168. package/dist/icons/stroke/stroke-warranty10y-icon.js +7 -0
  169. package/dist/icons/stroke/stroke-warranty1y-icon.js +7 -0
  170. package/dist/icons/stroke/stroke-warranty3y-icon.js +7 -0
  171. package/dist/icons/stroke/stroke-warranty5y-icon.js +7 -0
  172. package/dist/icons/stroke/stroke-warrantyconsumable-icon.js +7 -0
  173. package/dist/icons/stroke/stroke-warrantylifetime-icon.js +7 -0
  174. package/dist/image-banner/image-banner.d.ts +20 -0
  175. package/dist/image-banner/image-banner.js +15 -0
  176. package/dist/image-banner/image-banner.module.css.js +3 -0
  177. package/dist/index.js +78 -33
  178. package/dist/intl/intl-provider.js +1 -1
  179. package/dist/intl/missing-translation-provider.js +1 -1
  180. package/dist/intl/translation-id.d.ts +1 -1
  181. package/dist/intl/use-intl.js +2 -2
  182. package/dist/lists/download-document-list/download-document-list.js +2 -1
  183. package/dist/lists/menu-list/menu-list-provider.js +1 -1
  184. package/dist/lists/menu-list/use-menu-list.js +2 -2
  185. package/dist/lists/product-overview-grid/product-overview-grid.d.ts +17 -2
  186. package/dist/lists/product-overview-grid/product-overview-grid.js +20 -8
  187. package/dist/lists/product-overview-grid/product-overview-grid.module.css.js +1 -1
  188. package/dist/loading/dynamic-loading-overlay.js +1 -23
  189. package/dist/loading/dynamic-loading-overlay.module.css.js +1 -1
  190. package/dist/media/image-cdn/image-cdn-profile.d.ts +45 -0
  191. package/dist/media/image-cdn/image-cdn-profile.js +63 -0
  192. package/dist/media/image-cdn/image-cdn-profile.test.d.ts +1 -0
  193. package/dist/media/image-cdn/image-cdn-provider.d.ts +10 -0
  194. package/dist/media/image-cdn/image-cdn-provider.js +15 -0
  195. package/dist/media/image-cdn/storyblok-profile.d.ts +3 -0
  196. package/dist/media/image-cdn/storyblok-profile.js +37 -0
  197. package/dist/media/image-cdn/storyblok-profile.test.d.ts +1 -0
  198. package/dist/media/image-lightbox/image-lightbox.module.css.js +1 -1
  199. package/dist/media/media-controls/media-chapters-control/media-chapters-control.d.ts +8 -0
  200. package/dist/media/media-controls/media-chapters-control/media-chapters-control.js +63 -0
  201. package/dist/media/media-controls/media-control/media-control.d.ts +19 -0
  202. package/dist/media/media-controls/media-control/media-control.js +15 -0
  203. package/dist/media/media-controls/media-controls.d.ts +12 -0
  204. package/dist/media/media-controls/media-controls.js +17 -0
  205. package/dist/media/media-controls/media-controls.module.css.js +3 -0
  206. package/dist/media/media-controls/media-popover/media-popover.d.ts +12 -0
  207. package/dist/media/media-controls/media-popover/media-popover.js +67 -0
  208. package/dist/media/media-controls/media-progress-circle/media-progress-circle.d.ts +20 -0
  209. package/dist/media/media-controls/media-progress-circle/media-progress-circle.js +31 -0
  210. package/dist/media/media-controls/media-seek-control/media-seek-control.d.ts +6 -0
  211. package/dist/media/media-controls/media-seek-control/media-seek-control.js +30 -0
  212. package/dist/media/media-controls/media-subs-control/media-subs-control.d.ts +8 -0
  213. package/dist/media/media-controls/media-subs-control/media-subs-control.js +65 -0
  214. package/dist/media/media-controls/media-volume-control/media-volume-control.d.ts +7 -0
  215. package/dist/media/media-controls/media-volume-control/media-volume-control.js +103 -0
  216. package/dist/media/media-utils.d.ts +19 -0
  217. package/dist/media/media-utils.js +28 -0
  218. package/dist/media/responsive-image/responsive-image.d.ts +37 -0
  219. package/dist/media/responsive-image/responsive-image.js +119 -0
  220. package/dist/media/responsive-image/responsive-image.module.css.js +3 -0
  221. package/dist/media/responsive-video/responsive-video.d.ts +36 -0
  222. package/dist/media/responsive-video/responsive-video.js +365 -0
  223. package/dist/media/responsive-video/responsive-video.module.css.js +3 -0
  224. package/dist/modals/dialog/dialog.js +1 -1
  225. package/dist/navigation/panel-navigation/panel-navigation.js +1 -1
  226. package/dist/notifications/announcements/announcement-list.d.ts +10 -1
  227. package/dist/notifications/announcements/announcement-list.js +1 -13
  228. package/dist/notifications/announcements/announcement-list.module.css.js +1 -1
  229. package/dist/notifications/announcements/announcement.d.ts +13 -2
  230. package/dist/notifications/announcements/announcement.js +14 -6
  231. package/dist/notifications/announcements/fixtures/fixtures.d.ts +22 -0
  232. package/dist/page-layout/fixtures/fixtures.d.ts +15 -0
  233. package/dist/page-layout/page-layout.d.ts +2 -0
  234. package/dist/page-layout/page-layout.js +33 -0
  235. package/dist/page-layout/page-layout.module.css.js +3 -0
  236. package/dist/page-layout/types.d.ts +52 -0
  237. package/dist/pages/account/change-password-page/change-password-page.js +6 -2
  238. package/dist/pages/account/components/change-password-form/change-password-form.js +1 -5
  239. package/dist/pages/account/components/create-account-form/create-account-form.js +1 -4
  240. package/dist/pages/account/components/sign-in-form/sign-in-form.js +2 -6
  241. package/dist/pages/account/create-account-page/create-account-page.d.ts +1 -1
  242. package/dist/pages/account/create-account-page/create-account-page.js +8 -4
  243. package/dist/pages/account/sign-in-page/sign-in-page.d.ts +1 -1
  244. package/dist/pages/account/sign-in-page/sign-in-page.js +6 -4
  245. package/dist/pages/checkout/cart-page/cart-page.d.ts +1 -1
  246. package/dist/pages/checkout/cart-page/cart-page.js +35 -68
  247. package/dist/pages/checkout/components/billing-and-invoice-information.js +1 -1
  248. package/dist/pages/checkout/components/billing-and-invoice-information.module.css.js +1 -1
  249. package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section-header.d.ts +1 -1
  250. package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section-header.js +2 -2
  251. package/dist/pages/checkout/components/checkout-page-section.js +12 -0
  252. package/dist/pages/checkout/components/checkout-page-section.module.css.js +3 -0
  253. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +50 -64
  254. package/dist/pages/checkout/payment-page/payment-page-content.js +25 -25
  255. package/dist/pages/checkout/shipping-page/components/edit-checkout-bill-to-address-form.js +2 -2
  256. package/dist/pages/checkout/shipping-page/components/readonly-address.js +3 -3
  257. package/dist/pages/checkout/shipping-page/components/readonly-address.module.css.js +1 -1
  258. package/dist/pages/checkout/shipping-page/shipping-page-content.js +12 -12
  259. package/dist/pages/components/page/page.js +1 -1
  260. package/dist/pages/countries-page/countries-page.js +7 -4
  261. package/dist/pages/error-page/error-page.js +2 -7
  262. package/dist/pages/my-sonic/navigation/connected-my-sonic-navigation.js +2 -1
  263. package/dist/pages/my-sonic/pages/create-ship-to-address-details-page/create-ship-to-address-details-page.d.ts +0 -3
  264. package/dist/pages/my-sonic/pages/create-ship-to-address-details-page/create-ship-to-address-details-page.js +16 -17
  265. package/dist/pages/my-sonic/pages/edit-bill-to-address-details-page/edit-bill-to-address-details-page.d.ts +0 -3
  266. package/dist/pages/my-sonic/pages/edit-bill-to-address-details-page/edit-bill-to-address-details-page.js +16 -17
  267. package/dist/pages/my-sonic/pages/edit-ship-to-address-details-page/edit-ship-to-address-details-page.d.ts +0 -4
  268. package/dist/pages/my-sonic/pages/edit-ship-to-address-details-page/edit-ship-to-address-details-page.js +16 -17
  269. package/dist/pages/my-sonic/pages/favorites/favorites-page.d.ts +0 -1
  270. package/dist/pages/my-sonic/pages/favorites/favorites-page.js +31 -33
  271. package/dist/pages/my-sonic/pages/favorites/favorites-page.module.css.js +3 -0
  272. package/dist/pages/my-sonic/pages/my-account/my-account-page.d.ts +0 -1
  273. package/dist/pages/my-sonic/pages/my-account/my-account-page.js +12 -12
  274. package/dist/pages/my-sonic/pages/order-details/order-details-content.d.ts +2 -1
  275. package/dist/pages/my-sonic/pages/order-details/order-details-content.js +4 -4
  276. package/dist/pages/my-sonic/pages/order-details/order-details-content.module.css.js +1 -1
  277. package/dist/pages/my-sonic/pages/order-details/order-details-page.d.ts +2 -4
  278. package/dist/pages/my-sonic/pages/order-details/order-details-page.js +19 -29
  279. package/dist/pages/my-sonic/pages/order-history/order-history-page.d.ts +0 -1
  280. package/dist/pages/my-sonic/pages/order-history/order-history-page.js +112 -116
  281. package/dist/pages/my-sonic/pages/upload-order-page/upload-order-page.d.ts +0 -1
  282. package/dist/pages/my-sonic/pages/upload-order-page/upload-order-page.js +12 -12
  283. package/dist/pages/product/components/product-overview.d.ts +11 -3
  284. package/dist/pages/product/components/product-overview.js +11 -7
  285. package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.js +5 -7
  286. package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.module.css.js +1 -1
  287. package/dist/pages/product/product-details-page/components/product-details-recently-viewed-section/product-details-recently-viewed-section.d.ts +3 -1
  288. package/dist/pages/product/product-details-page/components/product-details-recently-viewed-section/product-details-recently-viewed-section.js +9 -10
  289. package/dist/pages/product/product-details-page/product-details.js +18 -18
  290. package/dist/pages/product/product-details-page/product-details.module.css.js +3 -0
  291. package/dist/pages/product/product-listing-page/no-results/no-results.d.ts +3 -5
  292. package/dist/pages/product/product-listing-page/no-results/no-results.js +2 -4
  293. package/dist/pages/product/product-listing-page/no-results/no-results.module.css.js +1 -1
  294. package/dist/pages/product/product-listing-page/product-listing-page-category-carousel/product-listing-page-category-carousel.js +6 -4
  295. package/dist/pages/product/product-listing-page/product-listing-page-category-carousel/product-listing-page-category-carousel.module.css.js +3 -0
  296. package/dist/pages/product/product-listing-page/product-listing-page-provider/product-listing-page-provider.js +3 -3
  297. package/dist/pages/product/product-listing-page/product-listing-page.js +1 -1
  298. package/dist/pages/product/product-listing-page/product-listing-page.module.css.js +1 -1
  299. package/dist/pages/product/product-listing-page/product-listing-product-overview/product-listing-product-overview.d.ts +2 -1
  300. package/dist/pages/product/product-listing-page/product-listing-product-overview/product-listing-product-overview.js +2 -2
  301. package/dist/pages/product/product-listing-page/product-listing.d.ts +8 -1
  302. package/dist/pages/product/product-listing-page/product-listing.js +23 -23
  303. package/dist/pages/product/search-result-page/search-result-product-overview/search-result-product-overview.d.ts +2 -1
  304. package/dist/pages/product/search-result-page/search-result-product-overview/search-result-product-overview.js +2 -2
  305. package/dist/pages/product/search-result-page/search-results-page.js +20 -19
  306. package/dist/promos/promo-banners/promo-banners.js +2 -1
  307. package/dist/responsive-banner/responsive-banner.d.ts +30 -0
  308. package/dist/responsive-banner/responsive-banner.js +23 -0
  309. package/dist/responsive-banner/responsive-banner.module.css.js +3 -0
  310. package/dist/responsive-carousel/responsive-carousel.d.ts +18 -0
  311. package/dist/responsive-carousel/responsive-carousel.js +209 -0
  312. package/dist/responsive-carousel/responsive-carousel.module.css.js +3 -0
  313. package/dist/rich-text/rich-text.d.ts +7 -0
  314. package/dist/rich-text/rich-text.js +10 -0
  315. package/dist/rich-text/rich-text.module.css.js +3 -0
  316. package/dist/rte-asset/rte-asset.d.ts +8 -0
  317. package/dist/rte-asset/rte-asset.js +10 -0
  318. package/dist/rte-asset/rte-asset.module.css.js +3 -0
  319. package/dist/rte-blockquote/rte-blockquote.d.ts +8 -0
  320. package/dist/rte-blockquote/rte-blockquote.js +10 -0
  321. package/dist/rte-blockquote/rte-blockquote.module.css.js +3 -0
  322. package/dist/rte-details/rte-details.d.ts +7 -0
  323. package/dist/rte-details/rte-details.js +10 -0
  324. package/dist/rte-details/rte-details.module.css.js +3 -0
  325. package/dist/rte-ordered-list/rte-ordered-list.d.ts +14 -0
  326. package/dist/rte-ordered-list/rte-ordered-list.js +34 -0
  327. package/dist/rte-ordered-list/rte-ordered-list.module.css.js +3 -0
  328. package/dist/sections/about-section/about-section.d.ts +13 -0
  329. package/dist/sections/about-section/about-section.js +13 -0
  330. package/dist/sections/about-section/about-section.module.css.js +3 -0
  331. package/dist/sections/about-section/media-contact.d.ts +7 -0
  332. package/dist/sections/about-section/media-contact.js +12 -0
  333. package/dist/sections/banner-section/banner-section.d.ts +13 -0
  334. package/dist/sections/banner-section/banner-section.js +12 -0
  335. package/dist/sections/banner-section/banner-section.module.css.js +3 -0
  336. package/dist/sections/banner-section/fixtures/fixtures.d.ts +5 -0
  337. package/dist/sections/case-studies-listing-section/case-studies-listing-section.constants.d.ts +10 -0
  338. package/dist/sections/case-studies-listing-section/case-studies-listing-section.constants.js +12 -0
  339. package/dist/sections/case-studies-listing-section/case-studies-listing-section.d.ts +26 -0
  340. package/dist/sections/case-studies-listing-section/case-studies-listing-section.js +30 -0
  341. package/dist/sections/case-studies-listing-section/case-studies-listing-section.module.css.js +3 -0
  342. package/dist/sections/client-cases-carousel-section/client-cases-carousel-section.d.ts +13 -0
  343. package/dist/sections/client-cases-carousel-section/client-cases-carousel-section.js +13 -0
  344. package/dist/sections/client-cases-carousel-section/client-cases-carousel-section.module.css.js +3 -0
  345. package/dist/sections/downloadable-documents-section/downloadable-documents-section.d.ts +21 -0
  346. package/dist/sections/downloadable-documents-section/downloadable-documents-section.js +16 -0
  347. package/dist/sections/downloadable-documents-section/downloadable-documents-section.module.css.js +3 -0
  348. package/dist/sections/event-info-section/event-info-section.d.ts +9 -0
  349. package/dist/sections/event-info-section/event-info-section.js +23 -0
  350. package/dist/sections/event-info-section/event-info-section.module.css.js +3 -0
  351. package/dist/sections/faq-section/faq-section.d.ts +24 -0
  352. package/dist/sections/faq-section/faq-section.js +20 -0
  353. package/dist/sections/faq-section/faq-section.module.css.js +3 -0
  354. package/dist/sections/hero-section/hero-section.d.ts +22 -0
  355. package/dist/sections/hero-section/hero-section.js +16 -0
  356. package/dist/sections/hero-section/hero-section.module.css.js +3 -0
  357. package/dist/sections/hubspot-form-section/hubspot-form-section.d.ts +18 -0
  358. package/dist/sections/hubspot-form-section/hubspot-form-section.js +18 -0
  359. package/dist/sections/hubspot-form-section/hubspot-form-section.module.css.js +3 -0
  360. package/dist/sections/image-banner-carousel-section/image-banner-carousel-section.d.ts +12 -0
  361. package/dist/sections/image-banner-carousel-section/image-banner-carousel-section.js +13 -0
  362. package/dist/sections/image-banner-carousel-section/image-banner-carousel-section.module.css.js +3 -0
  363. package/dist/sections/image-banner-section/image-banner-section.d.ts +12 -0
  364. package/dist/sections/image-banner-section/image-banner-section.js +12 -0
  365. package/dist/sections/image-banner-section/image-banner-section.module.css.js +3 -0
  366. package/dist/sections/image-hubspot-section/image-hubspot-form-section.d.ts +21 -0
  367. package/dist/sections/image-hubspot-section/image-hubspot-form-section.js +19 -0
  368. package/dist/sections/image-hubspot-section/image-hubspot-form-section.module.css.js +3 -0
  369. package/dist/sections/image-section/image-section.d.ts +25 -0
  370. package/dist/sections/image-section/image-section.js +14 -0
  371. package/dist/sections/image-section/image-section.module.css.js +3 -0
  372. package/dist/sections/image-text-section/image-text-block.d.ts +13 -0
  373. package/dist/sections/image-text-section/image-text-block.js +13 -0
  374. package/dist/sections/image-text-section/image-text-section.d.ts +15 -0
  375. package/dist/sections/image-text-section/image-text-section.js +12 -0
  376. package/dist/sections/image-text-section/image-text-section.module.css.js +3 -0
  377. package/dist/sections/legal-section/legal-section.d.ts +10 -0
  378. package/dist/sections/legal-section/legal-section.js +13 -0
  379. package/dist/sections/legal-section/legal-section.module.css.js +3 -0
  380. package/dist/sections/multi-column-section/multi-column-section.d.ts +24 -0
  381. package/dist/sections/multi-column-section/multi-column-section.js +24 -0
  382. package/dist/sections/multi-column-section/multi-column-section.module.css.js +3 -0
  383. package/dist/sections/news-list-section/news-listing-section.d.ts +17 -0
  384. package/dist/sections/news-list-section/news-listing-section.js +27 -0
  385. package/dist/sections/news-list-section/news-listing-section.module.css.js +3 -0
  386. package/dist/sections/numbers-section/numbers-section.d.ts +18 -0
  387. package/dist/sections/numbers-section/numbers-section.js +15 -0
  388. package/dist/sections/numbers-section/numbers-section.module.css.js +3 -0
  389. package/dist/sections/page-meta-section/page-meta-section.d.ts +8 -0
  390. package/dist/sections/page-meta-section/page-meta-section.js +23 -0
  391. package/dist/sections/page-meta-section/page-meta-section.module.css.js +3 -0
  392. package/dist/sections/page-section/page-section.d.ts +297 -0
  393. package/dist/sections/page-section/page-section.js +23 -0
  394. package/dist/sections/page-section/page-section.module.css.js +3 -0
  395. package/dist/sections/percentages-section/percentages-section.d.ts +21 -0
  396. package/dist/sections/percentages-section/percentages-section.js +18 -0
  397. package/dist/sections/percentages-section/percentages-section.module.css.js +3 -0
  398. package/dist/sections/product-comparison-section/product-comparison-section.d.ts +17 -0
  399. package/dist/sections/product-comparison-section/product-comparison-section.js +19 -0
  400. package/dist/sections/product-comparison-section/product-comparison-section.module.css.js +3 -0
  401. package/dist/sections/rich-text-section/rich-text-section.d.ts +11 -0
  402. package/dist/sections/rich-text-section/rich-text-section.js +12 -0
  403. package/dist/sections/rich-text-section/rich-text-section.module.css.js +3 -0
  404. package/dist/sections/social-media-section/social-media-section.d.ts +20 -0
  405. package/dist/sections/social-media-section/social-media-section.js +27 -0
  406. package/dist/sections/social-media-section/social-media-section.module.css.js +3 -0
  407. package/dist/sections/subheadline-section/subheadline-section.d.ts +7 -0
  408. package/dist/sections/subheadline-section/subheadline-section.js +12 -0
  409. package/dist/sections/subheadline-section/subheadline-section.module.css.js +3 -0
  410. package/dist/sections/usp-section/usp-section.d.ts +19 -0
  411. package/dist/sections/usp-section/usp-section.js +17 -0
  412. package/dist/sections/usp-section/usp-section.module.css.js +3 -0
  413. package/dist/sections/video-section/video-section.d.ts +30 -0
  414. package/dist/sections/video-section/video-section.js +13 -0
  415. package/dist/sections/video-section/video-section.module.css.js +3 -0
  416. package/dist/shared/error/default-error-view.d.ts +1 -1
  417. package/dist/shared/error/default-error-view.js +4 -2
  418. package/dist/shared/error/default-error-view.module.css.js +1 -1
  419. package/dist/shared/error/global-unhandled-error-handler.js +3 -3
  420. package/dist/shared/feature-flags/use-feature-flags.d.ts +1 -0
  421. package/dist/shared/feature-flags/use-feature-flags.js +3 -2
  422. package/dist/shared/hooks/use-drag-scroll.d.ts +20 -0
  423. package/dist/shared/hooks/use-drag-scroll.js +107 -0
  424. package/dist/shared/local-storage/local-storage-provider.js +1 -1
  425. package/dist/shared/local-storage/use-local-storage.js +2 -2
  426. package/dist/shared/local-storage/use-session-storage.js +2 -2
  427. package/dist/shared/model/announcement.d.ts +1 -0
  428. package/dist/shared/model/image.d.ts +5 -0
  429. package/dist/shared/providers/global-state-provider.js +3 -3
  430. package/dist/shared/routing/route-provider.js +1 -1
  431. package/dist/shared/routing/use-router.js +2 -2
  432. package/dist/shared/utils/array.d.ts +1 -0
  433. package/dist/shared/utils/array.js +9 -1
  434. package/dist/shared/utils/array.test.d.ts +1 -0
  435. package/dist/sidebar/sidebar.js +2 -2
  436. package/dist/site-layout/site-layout.d.ts +15 -0
  437. package/dist/site-layout/site-layout.js +39 -0
  438. package/dist/site-layout/site-layout.module.css.js +3 -0
  439. package/dist/styles.css +10859 -3344
  440. package/dist/table/elements/table-provider.js +1 -1
  441. package/dist/table/elements/table-row-provider.js +1 -1
  442. package/dist/table/elements/table.js +2 -2
  443. package/dist/table/elements/use-table-row.js +2 -2
  444. package/dist/table/elements/use-table.js +2 -2
  445. package/dist/toast/toast.d.ts +6 -1
  446. package/dist/toast/toast.js +2 -3
  447. package/dist/typography/heading/heading.d.ts +18 -10
  448. package/dist/typography/heading/heading.js +28 -14
  449. package/dist/typography/heading/heading.module.css.js +1 -1
  450. package/package.json +6 -5
  451. package/dist/buttons/print-button/print-button.d.ts +0 -2
  452. package/dist/buttons/print-button/print-button.js +0 -10
  453. package/dist/footer/connected-footer.d.ts +0 -3
  454. package/dist/footer/connected-footer.js +0 -21
  455. package/dist/header/connected-header.d.ts +0 -3
  456. package/dist/header/connected-header.js +0 -21
  457. package/dist/notifications/announcements/connected-announcement-list.d.ts +0 -3
  458. package/dist/notifications/announcements/connected-announcement-list.js +0 -22
  459. package/dist/notifications/announcements/use-filter-announcements.d.ts +0 -2
  460. package/dist/notifications/announcements/use-filter-announcements.js +0 -35
  461. package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-background-image.d.ts +0 -6
  462. package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-background-image.js +0 -9
  463. package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.d.ts +0 -9
  464. package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.js +0 -12
  465. package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.module.css.js +0 -3
  466. package/dist/pages/checkout/cart-page/components/empty-cart-page.d.ts +0 -1
  467. package/dist/pages/checkout/cart-page/components/empty-cart-page.js +0 -12
  468. package/dist/pages/checkout/layouts/checkout-page-layout/checkout-page-layout.d.ts +0 -11
  469. package/dist/pages/checkout/layouts/checkout-page-layout/checkout-page-layout.js +0 -34
  470. package/dist/pages/checkout/layouts/checkout-page-layout/checkout-page-layout.module.css.js +0 -3
  471. package/dist/pages/checkout/layouts/checkout-page-layout/components/checkout-page-section.js +0 -11
  472. package/dist/pages/checkout/layouts/checkout-page-layout/components/checkout-page-section.module.css.js +0 -3
  473. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-aside.d.ts +0 -4
  474. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-aside.js +0 -9
  475. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-breadcrumb.d.ts +0 -4
  476. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-breadcrumb.js +0 -9
  477. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-main.d.ts +0 -4
  478. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-main.js +0 -9
  479. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-page.d.ts +0 -5
  480. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-page.js +0 -10
  481. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-pre-aside.d.ts +0 -4
  482. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-pre-aside.js +0 -9
  483. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-title.d.ts +0 -4
  484. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-title.js +0 -10
  485. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.d.ts +0 -5
  486. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.js +0 -10
  487. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.module.css.js +0 -3
  488. package/dist/pages/product/layouts/product-details-page-layout/product-details-page-layout.d.ts +0 -9
  489. package/dist/pages/product/layouts/product-details-page-layout/product-details-page-layout.js +0 -10
  490. package/dist/pages/product/layouts/product-details-page-layout/product-details-page-layout.module.css.js +0 -3
  491. package/dist/pages/product/product-details-page/components/product-details-recently-viewed-section/product-details-recently-viewed-section.module.css.js +0 -3
  492. package/dist/pages/product/search-result-page/search-results-page.module.css.js +0 -3
  493. /package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section-content.d.ts +0 -0
  494. /package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section-content.js +0 -0
  495. /package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section-link.d.ts +0 -0
  496. /package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section-link.js +0 -0
  497. /package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section.d.ts +0 -0
@@ -1,14 +1,17 @@
1
1
  "use client";
2
2
  import { useHits } from 'react-instantsearch';
3
- import { useAlgoliaHitsItems, useAlgoliaHitsLoading } from './use-algolia-hits.js';
3
+ import { useAlgoliaHitsItems, useAlgoliaHitsLoading, useAlgoliaHitsPage } from './use-algolia-hits.js';
4
4
  import { useAlgoliaInstantSearchState } from './use-algolia-instant-search-state.js';
5
5
 
6
6
  function AlgoliaHitsProvider() {
7
7
  const { status } = useAlgoliaInstantSearchState();
8
8
  const [, setItems] = useAlgoliaHitsItems();
9
9
  const [, setLoading] = useAlgoliaHitsLoading();
10
+ const [, setPage] = useAlgoliaHitsPage();
10
11
  const { items, results } = useHits();
11
12
  setItems(items);
13
+ // Page of the results the items came from, the pagination state already changes before the new results arrive
14
+ setPage(results?.page ?? 0);
12
15
  // @ts-expect-error -- params is not officially exposed but is included in results
13
16
  setLoading(status !== 'idle' || !results || results.params === '');
14
17
  return null;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { createContext, useContext, useMemo } from 'react';
3
+ import { createContext, use, useMemo } from 'react';
4
4
  import { useCultureCode } from '../intl/use-culture-code.js';
5
5
  import { getLanguageCodeFromCultureCode } from '../intl/utils.js';
6
6
  import { environment } from '../shared/utils/environment.js';
@@ -12,14 +12,14 @@ function AlgoliaInsightsProvider({ children, value, }) {
12
12
  const cultureCode = useCultureCode();
13
13
  const algoliaIndex = getAlgoliaIndex(environment, getLanguageCodeFromCultureCode(cultureCode));
14
14
  const [globalState] = useAlgoliaInsightsGlobalState();
15
- const context = useContext(AlgoliaInsightsProviderContext);
15
+ const context = use(AlgoliaInsightsProviderContext);
16
16
  const combinedValue = useMemo(() => ({
17
17
  index: algoliaIndex.default,
18
18
  ...globalState,
19
19
  ...context,
20
20
  ...value,
21
21
  }), [algoliaIndex.default, context, globalState, value]);
22
- return (jsx(AlgoliaInsightsProviderContext.Provider, { value: combinedValue, children: children }));
22
+ return (jsx(AlgoliaInsightsProviderContext, { value: combinedValue, children: children }));
23
23
  }
24
24
 
25
25
  export { AlgoliaInsightsProvider, AlgoliaInsightsProviderContext };
@@ -5,13 +5,16 @@ interface AlgoliaProviderProps {
5
5
  categoryPages?: string;
6
6
  children: ReactNode;
7
7
  hierarchicalCategories?: string[];
8
+ hitsPerPage?: number;
8
9
  languageCode: LanguageCode;
9
10
  offlineSearchClient?: SearchClient;
10
11
  online?: boolean;
11
12
  query?: string;
13
+ /** Number of hits to leave out of the first page only, e.g. to make room for a promo card */
14
+ reservedFirstPageSlots?: number;
12
15
  searchClient: SearchClient;
13
16
  }
14
- export declare function AlgoliaProvider({ categoryPages, children, hierarchicalCategories, languageCode, offlineSearchClient, online: _online, query, searchClient, }: AlgoliaProviderProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function AlgoliaProvider({ categoryPages, children, hierarchicalCategories, hitsPerPage, languageCode, offlineSearchClient, online: _online, query, reservedFirstPageSlots, searchClient, }: AlgoliaProviderProps): import("react/jsx-runtime").JSX.Element;
15
18
  export declare function useAlgolia(): {
16
19
  online: boolean;
17
20
  setOnline: import("../shared/providers/global-state-provider").UpdateGlobalState<boolean>;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useMemo } from 'react';
3
4
  import { InstantSearch, Configure } from 'react-instantsearch';
4
5
  import { useGlobalState } from '../shared/providers/global-state-provider.js';
5
6
  import { environment } from '../shared/utils/environment.js';
@@ -8,23 +9,25 @@ import { getAlgoliaIndex } from './algolia-index-config.js';
8
9
  import { AlgoliaInsightInstantSearchProvider } from './algolia-insight-instant-search-provider.js';
9
10
  import { AlgoliaInstantSearchStateProvider } from './algolia-instant-search-state-provider.js';
10
11
  import { createQueryStringRouting } from './algolia-query-string-routing.js';
12
+ import { withReservedFirstPageSlots } from './algolia-searchclient-reserved-slots.js';
11
13
  import { useAlgoliaInstantSearchState } from './use-algolia-instant-search-state.js';
12
14
 
13
- function AlgoliaProvider({ categoryPages, children, hierarchicalCategories, languageCode, offlineSearchClient, online: _online = true, query, searchClient, }) {
15
+ function AlgoliaProvider({ categoryPages, children, hierarchicalCategories, hitsPerPage = 12, languageCode, offlineSearchClient, online: _online = true, query, reservedFirstPageSlots = 0, searchClient, }) {
14
16
  const { online } = useAlgoliaInstantSearchState({
15
17
  online: _online,
16
18
  });
17
19
  const algoliaIndex = getAlgoliaIndex(environment, languageCode);
20
+ const activeSearchClient = useMemo(() => withReservedFirstPageSlots(online ? searchClient : offlineSearchClient || searchClient, reservedFirstPageSlots), [online, offlineSearchClient, reservedFirstPageSlots, searchClient]);
18
21
  return (jsxs(InstantSearch, { future: {
19
22
  persistHierarchicalRootCount: true,
20
23
  preserveSharedStateOnUnmount: true,
21
24
  }, indexName: algoliaIndex.default, insights: true, routing: createQueryStringRouting({
22
25
  algoliaIndex,
23
26
  hierarchicalCategories,
24
- }), searchClient: online ? searchClient : offlineSearchClient || searchClient, children: [jsx(Configure, { analytics: true, filters: categoryPages
27
+ }), searchClient: activeSearchClient, children: [jsx(Configure, { analytics: true, filters: categoryPages
25
28
  ? // Replace double quotes with escaped double quotes to avoid breaking the query
26
29
  `categoryPages: "${categoryPages.replaceAll('"', String.raw `\"`)}"`
27
- : undefined, hitsPerPage: 12, maxValuesPerFacet: 100, query: query, ruleContexts: ['storefront'] }), jsx(AlgoliaInstantSearchStateProvider, {}), jsx(AlgoliaHitsProvider, {}), jsx(AlgoliaInsightInstantSearchProvider, { children: children })] }));
30
+ : undefined, hitsPerPage: hitsPerPage, maxValuesPerFacet: 100, query: query, ruleContexts: ['storefront'] }), jsx(AlgoliaInstantSearchStateProvider, {}), jsx(AlgoliaHitsProvider, {}), jsx(AlgoliaInsightInstantSearchProvider, { children: children })] }));
28
31
  }
29
32
  function useAlgolia() {
30
33
  const [online, setOnline] = useGlobalState('algolia', false);
@@ -192,7 +192,7 @@ function AlgoliaSearchProvider({ children, searchClient: _searchClient, }) {
192
192
  index: productsIndexName,
193
193
  };
194
194
  }, [productsIndexName]);
195
- return (jsx(AlgoliaInsightsProvider, { value: insightsProviderValue, children: jsx(GlobalSearchContext.Provider, { value: globalSearchContextValue, children: typeof children === 'function' ? children(autocomplete) : children }) }));
195
+ return (jsx(AlgoliaInsightsProvider, { value: insightsProviderValue, children: jsx(GlobalSearchContext, { value: globalSearchContextValue, children: typeof children === 'function' ? children(autocomplete) : children }) }));
196
196
  }
197
197
 
198
198
  export { AlgoliaSearchProvider, GlobalSearchContext };
@@ -0,0 +1,25 @@
1
+ import { SearchClient } from 'algoliasearch';
2
+ interface PagingOptions {
3
+ hitsPerPage: number;
4
+ reservedSlots: number;
5
+ }
6
+ /**
7
+ * Skip/take for a page where the first page has `reservedSlots` fewer hits
8
+ * (e.g. to make room for a promo card) and every following page is full.
9
+ */
10
+ export declare function getSkipTake({ hitsPerPage, page, reservedSlots, }: PagingOptions & {
11
+ page: number;
12
+ }): {
13
+ skip: number;
14
+ take: number;
15
+ };
16
+ export declare function getPageCount({ hitsPerPage, reservedSlots, totalHits, }: PagingOptions & {
17
+ totalHits: number;
18
+ }): number;
19
+ /**
20
+ * Wraps a search client so InstantSearch can keep paginating by page number
21
+ * while Algolia is queried with skip/take (`offset`/`length`), allowing the
22
+ * first page to reserve slots without skipping hits on later pages.
23
+ */
24
+ export declare function withReservedFirstPageSlots(searchClient: SearchClient, reservedSlots: number): SearchClient;
25
+ export {};
@@ -0,0 +1,67 @@
1
+ import { MAX_QUERY_RESULTS } from './constants/index.js';
2
+
3
+ /**
4
+ * Skip/take for a page where the first page has `reservedSlots` fewer hits
5
+ * (e.g. to make room for a promo card) and every following page is full.
6
+ */
7
+ function getSkipTake({ hitsPerPage, page, reservedSlots, }) {
8
+ const firstPageTake = Math.max(hitsPerPage - reservedSlots, 0);
9
+ if (page === 0)
10
+ return { skip: 0, take: firstPageTake };
11
+ return {
12
+ skip: firstPageTake + (page - 1) * hitsPerPage,
13
+ take: hitsPerPage,
14
+ };
15
+ }
16
+ function getPageCount({ hitsPerPage, reservedSlots, totalHits, }) {
17
+ if (totalHits === 0)
18
+ return 0;
19
+ const firstPageTake = Math.max(hitsPerPage - reservedSlots, 0);
20
+ const remainingHits = Math.max(totalHits - firstPageTake, 0);
21
+ return 1 + Math.ceil(remainingHits / hitsPerPage);
22
+ }
23
+ /**
24
+ * Wraps a search client so InstantSearch can keep paginating by page number
25
+ * while Algolia is queried with skip/take (`offset`/`length`), allowing the
26
+ * first page to reserve slots without skipping hits on later pages.
27
+ */
28
+ function withReservedFirstPageSlots(searchClient, reservedSlots) {
29
+ if (reservedSlots <= 0)
30
+ return searchClient;
31
+ return {
32
+ ...searchClient,
33
+ search: async (...[queries, requestOptions]) => {
34
+ const response = await searchClient.search(queries.map(query => {
35
+ const { hitsPerPage, page = 0 } = query.params ?? {};
36
+ // Facet-only requests (hitsPerPage 0) don't return hits
37
+ if (!hitsPerPage)
38
+ return query;
39
+ const { skip, take } = getSkipTake({
40
+ hitsPerPage,
41
+ page,
42
+ reservedSlots,
43
+ });
44
+ return {
45
+ ...query,
46
+ params: { ...query.params, length: take, offset: skip },
47
+ };
48
+ }), requestOptions);
49
+ return {
50
+ ...response,
51
+ results: response.results.map((result, index) => {
52
+ const { hitsPerPage, page = 0 } = queries[index]?.params ?? {};
53
+ if (!hitsPerPage || !('nbHits' in result))
54
+ return result;
55
+ const nbPages = getPageCount({
56
+ hitsPerPage,
57
+ reservedSlots,
58
+ totalHits: Math.min(result.nbHits, MAX_QUERY_RESULTS),
59
+ });
60
+ return { ...result, hitsPerPage, nbPages, page };
61
+ }),
62
+ };
63
+ },
64
+ };
65
+ }
66
+
67
+ export { getPageCount, getSkipTake, withReservedFirstPageSlots };
@@ -1,10 +1,13 @@
1
- import { ProductHit, PromoHit } from '../shared/model/hit';
1
+ import { ProductHit } from '../shared/model/hit';
2
2
  import { AlgoliaHit } from './algolia-hit-type';
3
3
  export declare const useAlgoliaHitsItems: () => [AlgoliaHit[], import("../shared/providers/global-state-provider").UpdateGlobalState<AlgoliaHit[]>];
4
4
  export declare const useAlgoliaHitsLoading: () => [boolean | undefined, import("../shared/providers/global-state-provider").UpdateGlobalState<boolean | undefined>];
5
+ /** Zero-based page of the results the hits belong to */
6
+ export declare const useAlgoliaHitsPage: () => [number, import("../shared/providers/global-state-provider").UpdateGlobalState<number>];
5
7
  interface UseHitsReturnType {
6
- hits: (ProductHit | PromoHit)[];
8
+ hits: ProductHit[];
7
9
  isLoading: boolean | undefined;
10
+ page: number;
8
11
  }
9
12
  export declare function useAlgoliaHits(): UseHitsReturnType;
10
13
  export {};
@@ -1,19 +1,23 @@
1
1
  "use client";
2
- import { transformAlgoliaProductHitToProductHit, transformAlgoliaPromoHitToPromoHit } from '../shared/model/hit.js';
2
+ import { transformAlgoliaProductHitToProductHit } from '../shared/model/hit.js';
3
3
  import { useGlobalState } from '../shared/providers/global-state-provider.js';
4
4
  import { isAlgoliaProductHit } from './algolia-hit-type.js';
5
5
 
6
6
  const useAlgoliaHitsItems = () => useGlobalState('algolia-product-hits-items', []);
7
7
  const useAlgoliaHitsLoading = () => useGlobalState('algolia-product-hits-loading');
8
+ /** Zero-based page of the results the hits belong to */
9
+ const useAlgoliaHitsPage = () => useGlobalState('algolia-product-hits-page', 0);
8
10
  function useAlgoliaHits() {
9
11
  const [items] = useAlgoliaHitsItems();
10
12
  const [isLoading] = useAlgoliaHitsLoading();
13
+ const [page] = useAlgoliaHitsPage();
11
14
  return {
12
- hits: items.map(hit => isAlgoliaProductHit(hit)
13
- ? transformAlgoliaProductHitToProductHit(hit)
14
- : transformAlgoliaPromoHitToPromoHit(hit)),
15
+ hits: items
16
+ .filter(isAlgoliaProductHit)
17
+ .map(hit => transformAlgoliaProductHitToProductHit(hit)),
15
18
  isLoading,
19
+ page,
16
20
  };
17
21
  }
18
22
 
19
- export { useAlgoliaHits, useAlgoliaHitsItems, useAlgoliaHitsLoading };
23
+ export { useAlgoliaHits, useAlgoliaHitsItems, useAlgoliaHitsLoading, useAlgoliaHitsPage };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useContext, useMemo } from 'react';
2
+ import { use, useMemo } from 'react';
3
3
  import aa from 'search-insights';
4
4
  import { logger } from '../logging/logger.js';
5
5
  import { getCurrencyCodeBySymbol } from '../shared/model/currency.js';
@@ -13,7 +13,7 @@ function getCurrencyFromPriceString(priceString) {
13
13
  return getCurrencyCodeBySymbol(currencySymbol || '');
14
14
  }
15
15
  function useAlgoliaInsights() {
16
- const context = useContext(AlgoliaInsightsProviderContext);
16
+ const context = use(AlgoliaInsightsProviderContext);
17
17
  const [, setGlobalState] = useAlgoliaInsightsGlobalState();
18
18
  const result = useMemo(() => ({
19
19
  context,
@@ -1,11 +1,11 @@
1
1
  "use client";
2
- import { useContext } from 'react';
2
+ import { use } from 'react';
3
3
  import { transformAlgoliaProductHitToProductHit, transformAlgoliaPromoHitToPromoHit } from '../shared/model/hit.js';
4
4
  import { isAlgoliaProductHit } from './algolia-hit-type.js';
5
5
  import { GlobalSearchContext } from './algolia-search-provider.js';
6
6
 
7
7
  function useAlgoliaSearch() {
8
- const globalSearch = useContext(GlobalSearchContext);
8
+ const globalSearch = use(GlobalSearchContext);
9
9
  if (!globalSearch) {
10
10
  throw new Error('This component must be wrapped with a GlobalSearchProvider');
11
11
  }
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  interface TagProps {
3
3
  children: ReactNode;
4
+ className?: string;
4
5
  }
5
- export declare function Tag({ children }: TagProps): import("react/jsx-runtime").JSX.Element | null;
6
+ export declare function Tag({ children, className }: TagProps): import("react/jsx-runtime").JSX.Element | null;
6
7
  export {};
@@ -1,11 +1,12 @@
1
1
  "use client";
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import clsx from 'clsx';
3
4
  import styles from './tag.module.css.js';
4
5
 
5
- function Tag({ children }) {
6
+ function Tag({ children, className }) {
6
7
  if (!children)
7
8
  return null;
8
- return (jsxs("div", { className: styles.tag, children: [jsx("div", { className: styles.body, "data-test-selector": "tag", children: children }), jsx("svg", { className: styles.shape, height: "16", viewBox: "0 0 9 16", width: "9", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M1.92461763,0 L0,0 L0,16 L1.92461763,16 L6.4117887,16 L8.87489381,7.57121588 C9.23711515,6.3325062 8.79482383,4.99454094 7.78060408,4.2560794 L1.92461763,0 Z", fill: "currentColor" }) })] }));
9
+ return (jsxs("div", { className: clsx(styles.tag, className), children: [jsx("div", { className: styles.body, "data-test-selector": "tag", children: children }), jsx("svg", { className: styles.shape, height: "16", viewBox: "0 0 9 16", width: "9", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M1.92461763,0 L0,0 L0,16 L1.92461763,16 L6.4117887,16 L8.87489381,7.57121588 C9.23711515,6.3325062 8.79482383,4.99454094 7.78060408,4.2560794 L1.92461763,0 Z", fill: "currentColor" }) })] }));
9
10
  }
10
11
 
11
12
  export { Tag };
package/dist/base.css CHANGED
@@ -20,7 +20,7 @@ body {
20
20
  }
21
21
 
22
22
  * {
23
- font-weight: normal;
23
+ font-weight: normal; /* incredibly harmful to use for an inherited property, should be removed when save */
24
24
  }
25
25
 
26
26
  span,
@@ -54,13 +54,40 @@ input[type='password'] {
54
54
  *********************************************************/
55
55
 
56
56
  html {
57
+ padding-right: 0 !important;
58
+ container-type: size;
57
59
  font-family: var(--font-family-sonic);
58
60
  font-size: var(--font-size-base);
59
61
  -webkit-font-smoothing: antialiased;
60
62
  -moz-osx-font-smoothing: grayscale;
61
63
  font-synthesis: none;
64
+ interpolate-size: allow-keywords;
65
+ scroll-behavior: smooth;
66
+ scroll-snap-type: y proximity;
67
+ scrollbar-gutter: stable;
62
68
  text-rendering: optimizelegibility;
63
69
  -webkit-text-size-adjust: none;
64
70
  -moz-text-size-adjust: none;
65
71
  text-size-adjust: none;
72
+ transition-behavior: allow-discrete;
73
+ }
74
+
75
+ html:has(:fullscreen) {
76
+ scrollbar-gutter: unset;
77
+ }
78
+
79
+ body {
80
+ margin: 0;
81
+ background: var(--site-background-color);
82
+ block-size: 100%;
83
+ color: var(--site-text-color);
84
+ font-size: var(--font-size-base);
85
+ hyphens: auto;
86
+ line-height: 1.5;
87
+ }
88
+
89
+ @property --scale-fraction {
90
+ inherits: true;
91
+ initial-value: 0;
92
+ syntax: '<number>';
66
93
  }
@@ -1,5 +1,5 @@
1
1
  export interface BreadcrumbLink {
2
- href: string;
2
+ href?: string;
3
3
  label: string;
4
4
  }
5
5
  export interface BreadcrumbProps {
@@ -11,7 +11,7 @@ function Breadcrumb({ links }) {
11
11
  return null;
12
12
  const linksWithoutFirst = links.slice(1);
13
13
  const homeLink = links[0];
14
- const previousLink = links.at(-2);
14
+ const previousLink = links.filter(link => link.href).at(-2);
15
15
  const isHomeLink = previousLink === undefined || previousLink === homeLink;
16
16
  const href = previousLink?.href || homeLink?.href;
17
17
  const label = previousLink?.label || homeLink?.label;
@@ -20,7 +20,7 @@ function Breadcrumb({ links }) {
20
20
  return (jsxs(Breadcrumbs, { className: styles.breadcrumbs, children: [jsx(Breadcrumb$1, { className: clsx(styles.breadcrumb, styles.short), children: jsxs(Link, { className: styles.link, href: href, isDisabled: false, title: label, children: [jsx(Icon, { className: styles.icon, name: "ArrowLeft", size: "xxs" }), isHomeLink ? (jsx(Icon, { className: styles.icon, name: "HomeSolid", size: "xxs" })) : (jsx("span", { children: previousLink.label }))] }) }), jsx(Breadcrumb$1, { className: clsx(styles.breadcrumb, styles.long), children: jsx(Link, { className: styles.link, href: homeLink.href, title: homeLink.label, children: jsx(Icon, { className: clsx(styles['home-icon'], styles.icon), name: "HomeSolid", size: "xxs" }) }) }), linksWithoutFirst.map((link, index) => (jsx(BreadcrumbLongItem, { index: index, isDisabled: linksWithoutFirst.length - 1 === index, link: link }, link.href + link.label || index)))] }));
21
21
  }
22
22
  function BreadcrumbLongItem({ index, isDisabled, link, }) {
23
- return (jsx(Breadcrumb$1, { className: clsx(styles.breadcrumb, styles.long), children: jsxs(Link, { className: styles.link, color: "secondary", href: link.href, isDisabled: isDisabled, title: link.label, children: [jsx(Icon, { className: clsx(styles.icon, styles['previous-icon']), name: "ArrowLeft" }), link.label] }) }, index));
23
+ return (jsx(Breadcrumb$1, { className: clsx(styles.breadcrumb, styles.long), children: link.href && !isDisabled ? (jsxs(Link, { className: styles.link, color: "secondary", href: link.href, title: link.label, children: [jsx(Icon, { className: clsx(styles.icon, styles['previous-icon']), name: "ArrowLeft" }), link.label] })) : (link.label) }, index));
24
24
  }
25
25
 
26
26
  export { Breadcrumb };
@@ -19,6 +19,7 @@ export interface ButtonProps {
19
19
  light?: boolean;
20
20
  name?: string;
21
21
  onClick?: (event: MouseEvent<HTMLElement>) => void;
22
+ placebo?: boolean;
22
23
  route?: NavigateOptions;
23
24
  size?: 'sm' | 'md' | 'lg';
24
25
  type?: 'button' | 'submit' | 'reset';
@@ -27,7 +28,7 @@ export interface ButtonProps {
27
28
  withArrow?: boolean;
28
29
  }
29
30
  export declare const Button: {
30
- ({ _pseudo, "aria-label": ariaLabel, children: _children, className, color, condensed, "data-test-selector": dataTestSelector, download, form, href, icon, iconPosition, isDisabled, isLoading, isValidating, light, name, onClick, ref, route, size, type, value, variant, withArrow, }: ButtonProps & {
31
+ ({ _pseudo, "aria-label": ariaLabel, children: _children, className, color, condensed, "data-test-selector": dataTestSelector, download, form, href, icon, iconPosition, isDisabled, isLoading, isValidating, light, name, onClick, placebo, ref, route, size, type, value, variant, withArrow, }: ButtonProps & {
31
32
  ref?: React.RefObject<HTMLButtonElement | null>;
32
33
  }): import("react/jsx-runtime").JSX.Element;
33
34
  displayName: string;
@@ -7,7 +7,7 @@ import { ProgressCircle } from '../../loading/progress-circle.js';
7
7
  import { useRouteLink } from '../../shared/routing/use-route-link.js';
8
8
  import buttonStyles from './button.module.css.js';
9
9
 
10
- const Button = ({ _pseudo = 'none', 'aria-label': ariaLabel, children: _children, className, color = 'primary', condensed, 'data-test-selector': dataTestSelector, download, form, href, icon, iconPosition = 'left', isDisabled, isLoading = false, isValidating = true, light = false, name, onClick, ref, route, size = 'lg', type = 'button', value, variant = 'solid', withArrow = false, }) => {
10
+ const Button = ({ _pseudo = 'none', 'aria-label': ariaLabel, children: _children, className, color = 'primary', condensed, 'data-test-selector': dataTestSelector, download, form, href, icon, iconPosition = 'left', isDisabled, isLoading = false, isValidating = true, light = false, name, onClick, placebo = false, ref, route, size = 'lg', type = 'button', value, variant = 'solid', withArrow = false, }) => {
11
11
  const { getRouteLinkProps, RouteLinkElement } = useRouteLink();
12
12
  const handleButtonClick = (e) => {
13
13
  if (onClick)
@@ -25,10 +25,18 @@ const Button = ({ _pseudo = 'none', 'aria-label': ariaLabel, children: _children
25
25
  const showIconOnRight = icon && iconPosition === 'right';
26
26
  const iconElement = icon && jsx("span", { className: buttonStyles.icon, children: icon });
27
27
  const children = (jsxs(Fragment, { children: [showIconOnLeft && iconElement, jsx("span", { className: buttonStyles.children, children: isLoading ? (isLoading === true ? _children : isLoading) : _children }), withArrow && (jsx(Icon, { className: buttonStyles['right-arrow-icon'], name: "ArrowRightThick" })), showIconOnRight && iconElement, isLoading && (jsx(ProgressCircle, { className: buttonStyles.spinner, size: "sm", variant: color === 'primary' ? 'white' : 'gray' }))] }));
28
+ if (href && download !== undefined) {
29
+ // File downloads must be a native link: the route link element
30
+ // prevents the default click and navigates client-side (and prefixes the
31
+ // locale), which would break the download.
32
+ return (jsx("a", { "aria-label": ariaLabel, className: classNames, "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, download: download, href: href, onClick: onClick, children: children }));
33
+ }
28
34
  if (href) {
29
- // TODO: only button currently supports ref for now
30
35
  return (jsx(RouteLinkElement, { "aria-label": ariaLabel, className: classNames, "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, download: download, onClick: onClick, type: type, ...getRouteLinkProps(href, route), children: children }));
31
36
  }
37
+ if (placebo) {
38
+ return (jsx("span", { ref: ref, "aria-label": ariaLabel, className: classNames, "data-disabled": isDisabled ? true : undefined, children: children }));
39
+ }
32
40
  return (jsx("button", { ref: ref, "aria-label": ariaLabel, className: classNames, "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, disabled: isDisabled, form: form, formNoValidate: isValidating ? undefined : true, name: name, onClick: handleButtonClick, type: type, value: value, children: children }));
33
41
  };
34
42
  Button.displayName = 'Button';
@@ -15,11 +15,18 @@ export interface IconButtonProps {
15
15
  isDisabled?: boolean;
16
16
  label: string;
17
17
  onClick?: (event: MouseEvent<HTMLElement>) => void;
18
+ rel?: string;
18
19
  round?: boolean;
19
20
  route?: NavigateOptions;
20
21
  size?: IconSize;
22
+ tabIndex?: number;
21
23
  target?: string;
22
24
  theme?: 'default' | 'secondary' | 'light';
23
25
  type?: 'button' | 'submit' | 'reset';
24
26
  }
25
- export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
27
+ export declare const IconButton: {
28
+ ({ badgeCount, badgeLabel, badgeStatus, children, className: _className, "data-test-selector": dataTestSelector, href, icon, isDisabled, label, onClick, ref, rel, round, route, size, tabIndex, target, theme, type, ...rest }: IconButtonProps & {
29
+ ref?: React.RefObject<HTMLButtonElement | null>;
30
+ }): import("react/jsx-runtime").JSX.Element;
31
+ displayName: string;
32
+ };
@@ -1,12 +1,11 @@
1
1
  "use client";
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
- import { forwardRef } from 'react';
4
3
  import clsx from 'clsx';
5
4
  import { IconWithBadge } from '../../badges/badge/icon-with-badge/icon-with-badge.js';
6
5
  import { useRouteLink } from '../../shared/routing/use-route-link.js';
7
6
  import styles from './icon-button.module.css.js';
8
7
 
9
- const IconButton = forwardRef(({ badgeCount, badgeLabel, badgeStatus, children, className: _className, 'data-test-selector': dataTestSelector, href, icon, isDisabled, label, onClick, round, route, size = 'md', target, theme, type = 'button', ...rest }, ref) => {
8
+ const IconButton = ({ badgeCount, badgeLabel, badgeStatus, children, className: _className, 'data-test-selector': dataTestSelector, href, icon, isDisabled, label, onClick, ref, rel, round, route, size = 'md', tabIndex, target, theme, type = 'button', ...rest }) => {
10
9
  const { getRouteLinkProps, RouteLinkElement } = useRouteLink();
11
10
  const handleButtonClick = (e) => {
12
11
  e.preventDefault();
@@ -15,10 +14,10 @@ const IconButton = forwardRef(({ badgeCount, badgeLabel, badgeStatus, children,
15
14
  };
16
15
  const className = clsx(styles['icon-button'], round && styles['round'], theme && styles[`theme-${theme}`], _className);
17
16
  if (href) {
18
- return (jsxs(RouteLinkElement, { className: className, "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, onClick: onClick, target: target, title: label, ...getRouteLinkProps(href, route), ...rest, children: [icon && !children && (jsx(IconWithBadge, { badgeCount: badgeCount, badgeLabel: badgeLabel, badgeStatus: badgeStatus, className: styles['icon'], icon: icon, label: label, size: size })), !icon && children && (jsx("div", { className: clsx(styles['icon'], styles[`size-${size}`]), children: children }))] }));
17
+ return (jsxs(RouteLinkElement, { className: className, "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, onClick: onClick, rel: rel, tabIndex: tabIndex, target: target, title: label, ...getRouteLinkProps(href, route), ...rest, children: [icon && !children && (jsx(IconWithBadge, { badgeCount: badgeCount, badgeLabel: badgeLabel, badgeStatus: badgeStatus, className: styles['icon'], icon: icon, label: label, size: size })), !icon && children && (jsx("div", { className: clsx(styles['icon'], styles[`size-${size}`]), children: children }))] }));
19
18
  }
20
- return (jsxs("button", { ref: ref, className: className, "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, disabled: isDisabled, onClick: handleButtonClick, title: label, type: type, ...rest, children: [icon && !children && (jsx(IconWithBadge, { badgeCount: badgeCount, badgeLabel: badgeLabel, badgeStatus: badgeStatus, className: styles['icon'], icon: icon, label: label, size: size })), !icon && children && (jsx("div", { className: clsx(styles['icon'], styles[`size-${size}`]), children: children }))] }));
21
- });
19
+ return (jsxs("button", { ref: ref, className: className, "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, disabled: isDisabled, onClick: handleButtonClick, rel: rel, tabIndex: tabIndex, title: label, type: type, ...rest, children: [icon && !children && (jsx(IconWithBadge, { badgeCount: badgeCount, badgeLabel: badgeLabel, badgeStatus: badgeStatus, className: styles['icon'], icon: icon, label: label, size: size })), !icon && children && (jsx("div", { className: clsx(styles['icon'], styles[`size-${size}`]), children: children }))] }));
20
+ };
22
21
  IconButton.displayName = 'IconButton';
23
22
 
24
23
  export { IconButton };
@@ -0,0 +1,8 @@
1
+ export interface InvoiceDownloadButtonsProps {
2
+ invoiceNumbers: string[];
3
+ }
4
+ /**
5
+ * Downloads an order's invoices: one button when there is one invoice, and a
6
+ * button that opens a menu of the invoice numbers when there are more.
7
+ */
8
+ export declare function InvoiceDownloadButtons({ invoiceNumbers, }: InvoiceDownloadButtonsProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { MenuTrigger, Button as Button$1, Popover, Menu, MenuItem } from 'react-aria-components';
4
+ import clsx from 'clsx';
5
+ import { Icon } from '../../icon/icon.js';
6
+ import { useFormattedMessage } from '../../intl/use-formatted-message.js';
7
+ import { Button } from '../button/button.js';
8
+ import { getInvoiceDownloadUrl } from './invoice-download-url.js';
9
+ import buttonStyles from '../button/button.module.css.js';
10
+ import styles from './invoice-download-buttons.module.css.js';
11
+
12
+ /**
13
+ * Downloads an order's invoices: one button when there is one invoice, and a
14
+ * button that opens a menu of the invoice numbers when there are more.
15
+ */
16
+ function InvoiceDownloadButtons({ invoiceNumbers, }) {
17
+ const t = useFormattedMessage();
18
+ const [firstInvoiceNumber] = invoiceNumbers;
19
+ if (firstInvoiceNumber === undefined)
20
+ return null;
21
+ if (invoiceNumbers.length === 1) {
22
+ return (jsx(Button, { color: "secondary", "data-test-selector": "invoice-download-button", download: `${firstInvoiceNumber}.pdf`, href: getInvoiceDownloadUrl(firstInvoiceNumber), variant: "outline", children: t('Download invoice') }));
23
+ }
24
+ // A react-aria button rather than <Button>, which renders a plain <button>
25
+ // that cannot open a menu; the classes keep it identical to the single one.
26
+ return (jsxs(MenuTrigger, { children: [jsxs(Button$1, { className: clsx(buttonStyles.button, buttonStyles.outline, buttonStyles.lg, buttonStyles.secondary), "data-test-selector": "invoice-download-menu-button", children: [jsx("span", { className: buttonStyles.children, children: t('Download invoice') }), jsx(Icon, { className: styles.chevron, name: "ArrowDown", size: "xxs" })] }), jsx(Popover, { className: styles.popover, placement: "bottom end", children: jsx(Menu, { "aria-label": t('Download invoice'), className: styles.menu, "data-test-selector": "invoice-download-menu", children: invoiceNumbers.map(invoiceNumber => (jsx(MenuItem, { className: styles.item, "data-test-selector": "invoice-download-menu-item", download: `${invoiceNumber}.pdf`, href: getInvoiceDownloadUrl(invoiceNumber), id: invoiceNumber, textValue: invoiceNumber, children: invoiceNumber }, invoiceNumber))) }) })] }));
27
+ }
28
+
29
+ export { InvoiceDownloadButtons };
@@ -0,0 +1,3 @@
1
+ var styles = {"chevron":"invoice-download-buttons-module-e3H5u","popover":"invoice-download-buttons-module-M1Mgb","menu":"invoice-download-buttons-module-7huLu","item":"invoice-download-buttons-module-Ejunn"};
2
+
3
+ export { styles as default };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Same-origin route implemented by the consuming app. It streams the invoice
3
+ * PDF as an attachment using the visitor's session cookies.
4
+ */
5
+ export declare function getInvoiceDownloadUrl(invoiceNumber: string): string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Same-origin route implemented by the consuming app. It streams the invoice
3
+ * PDF as an attachment using the visitor's session cookies.
4
+ */
5
+ function getInvoiceDownloadUrl(invoiceNumber) {
6
+ return `/api/invoices/${encodeURIComponent(invoiceNumber)}/pdf`;
7
+ }
8
+
9
+ export { getInvoiceDownloadUrl };
@@ -13,7 +13,7 @@ function DataCard({ actions, data, 'data-test-selector': dataTestSelector, isLoa
13
13
  const visibleData = dataFields.filter(dataField => isDataFieldVisible(dataField, rendering));
14
14
  const hasItems = visibleData.length > 0;
15
15
  const sections = sectionizeItems(data, rendering);
16
- return (jsxs("section", { className: styles['data-card-container'], "data-test-selector": dataTestSelector, children: [title && (jsx(Heading, { className: styles.title, size: "xxs", tag: "h3", children: jsx(FormattedMessage, { id: title }) })), jsx("div", { className: styles['data-card'], children: showError ? (jsx("div", { className: styles['error-container'], children: showError instanceof UnauthorizedRequestError ? (jsx(FormattedMessage, { id: "You are not authorized to access this information." })) : typeof showError === 'string' ? (jsx(FormattedMessage, { id: showError })) : (jsx(FormattedMessage, { id: "An unexpected error occured" })) })) : isLoading ? (jsx("div", { className: styles['loading-container'], children: jsx(ProgressCircle, { variant: "gray" }) })) : hasItems ? (jsxs("div", { className: clsx(styles['container']), children: [jsx("dl", { className: styles['data-table'], children: sections.map(section => (jsx(DataTableSection, { dataSection: section, rendering: rendering }, section.key))) }), Boolean(actions?.length) && (jsx("div", { className: styles['data-card-actions'], children: actions }))] })) : (jsx("div", { className: clsx(styles['no-data-container']), children: jsx(FormattedMessage, { id: "There is no information to display" }) })) })] }));
16
+ return (jsxs("section", { className: styles['data-card-container'], "data-test-selector": dataTestSelector, children: [title && (jsx(Heading, { italic: true, className: styles.title, responsive: false, size: "xs", tag: "h3", children: jsx(FormattedMessage, { id: title }) })), jsx("div", { className: styles['data-card'], children: showError ? (jsx("div", { className: styles['error-container'], children: showError instanceof UnauthorizedRequestError ? (jsx(FormattedMessage, { id: "You are not authorized to access this information." })) : typeof showError === 'string' ? (jsx(FormattedMessage, { id: showError })) : (jsx(FormattedMessage, { id: "An unexpected error occured" })) })) : isLoading ? (jsx("div", { className: styles['loading-container'], children: jsx(ProgressCircle, { variant: "gray" }) })) : hasItems ? (jsxs("div", { className: clsx(styles['container']), children: [jsx("dl", { className: styles['data-table'], children: sections.map(section => (jsx(DataTableSection, { dataSection: section, rendering: rendering }, section.key))) }), Boolean(actions?.length) && (jsx("div", { className: styles['data-card-actions'], children: actions }))] })) : (jsx("div", { className: clsx(styles['no-data-container']), children: jsx(FormattedMessage, { id: "There is no information to display" }) })) })] }));
17
17
  }
18
18
  function renderValue(rendering, key, value) {
19
19
  const renderedValue = rendering?.value
@@ -8,6 +8,7 @@ import { ProductSku } from '../../display/product-sku/product-sku.js';
8
8
  import { FormattedMessage } from '../../intl/formatted-message.js';
9
9
  import { logger } from '../../logging/logger.js';
10
10
  import { Image } from '../../media/image/image.js';
11
+ import { Heading } from '../../typography/heading/heading.js';
11
12
  import styles from './product-card.module.css.js';
12
13
 
13
14
  function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, id, image, onClick, price, route, sku, tags, title, }) {
@@ -16,7 +17,7 @@ function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: Favorit
16
17
  return;
17
18
  logger.error(`Product '${sku}' does not have a currency code`);
18
19
  }, [price.currencyCode, sku]);
19
- return (jsx("div", { className: styles['product-card-container'], children: jsxs("article", { "aria-labelledby": `title-${id}`, className: styles['product-card'], "data-product-id": sku, id: id, children: [jsx(Link, { className: styles.title, href: href, id: `title-${id}`, onClick: onClick, route: route, children: title }), tags && tags.length > 0 && (jsx("div", { className: styles.tags, children: tags.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { noTranslationId: true, fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) })), jsx(ProductSku, { className: styles.sku, sku: sku }), price.currencyCode && (jsx(Price, { className: styles.price, currencyCode: price.currencyCode, isVatIncluded: price.isVatIncluded, originalPrice: price.originalPrice, price: price.price, variant: "sonic" })), jsx("div", { className: styles['image-container'], children: jsx(Image, { ...image, fit: "contain" }) }), jsx("div", { className: styles['add-to-cart-button'], children: AddToCartButton && AddToCartButton }), jsx("div", { className: styles['favorite-button'], children: FavoriteButton && FavoriteButton })] }) }));
20
+ return (jsx("div", { className: styles['product-card-container'], children: jsxs("article", { "aria-labelledby": `title-${id}`, className: styles['product-card'], "data-product-id": sku, id: id, children: [jsx(Heading, { className: styles.title, size: "m", tag: "h3", children: jsx(Link, { className: styles.link, href: href, id: `title-${id}`, onClick: onClick, route: route, children: jsx("div", { className: styles.text, children: title }) }) }), tags && tags.length > 0 && (jsx("div", { className: styles.tags, children: tags.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { noTranslationId: true, fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) })), jsx(ProductSku, { className: styles.sku, sku: sku }), price.currencyCode && (jsx(Price, { className: styles.price, currencyCode: price.currencyCode, isVatIncluded: price.isVatIncluded, originalPrice: price.originalPrice, price: price.price, variant: "sonic" })), jsx("div", { className: styles['image-container'], children: jsx(Image, { ...image, fit: "contain" }) }), jsx("div", { className: styles['add-to-cart-button'], children: AddToCartButton && AddToCartButton }), jsx("div", { className: styles['favorite-button'], children: FavoriteButton && FavoriteButton })] }) }));
20
21
  }
21
22
 
22
23
  export { ProductCard };
@@ -1,3 +1,3 @@
1
- var styles = {"product-card-container":"product-card-module-LepTy","product-card":"product-card-module-pLaiB","title":"product-card-module-CStNi","favorite-button":"product-card-module-tvEdz","tags":"product-card-module-nL-hY","sku":"product-card-module-XzunM","image-container":"product-card-module-65ZVi","price":"product-card-module-irW0D","add-to-cart-button":"product-card-module-SnCvX"};
1
+ var styles = {"product-card-container":"product-card-module-LepTy","product-card":"product-card-module-pLaiB","price":"product-card-module-irW0D","favorite-button":"product-card-module-tvEdz","link":"product-card-module-Ov1pa","title":"product-card-module-CStNi","text":"product-card-module-cL3OG","tags":"product-card-module-nL-hY","sku":"product-card-module-XzunM","image-container":"product-card-module-65ZVi","add-to-cart-button":"product-card-module-SnCvX"};
2
2
 
3
3
  export { styles as default };
@@ -12,4 +12,9 @@ export interface TableCardProps {
12
12
  stickyHeader?: boolean;
13
13
  title?: TranslationId;
14
14
  }
15
- export declare const TableCard: import("react").ForwardRefExoticComponent<TableCardProps & import("react").RefAttributes<HTMLElement>>;
15
+ export declare const TableCard: {
16
+ ({ actions, children, className, "data-test-selector": dataTestSelector, id, isLoading, paging, ref, results, showError, stickyHeader, title, }: TableCardProps & {
17
+ ref?: React.RefObject<HTMLElement | null>;
18
+ }): import("react/jsx-runtime").JSX.Element;
19
+ displayName: string;
20
+ };