@vtex/faststore 0.0.8 → 0.0.11

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 (568) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +0 -1
  3. package/dist/actions.json +48 -1
  4. package/dist/catalog.json +1397 -1594
  5. package/dist/cli/index.d.ts +66 -28
  6. package/dist/cli/index.js +7371 -512
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/cli/server-runtime.js +41 -60
  9. package/dist/cli/server-runtime.js.map +1 -1
  10. package/dist/client.d.ts +3 -3
  11. package/dist/client.js +2 -2
  12. package/dist/components.d.ts +67 -56
  13. package/dist/components.js +64 -53
  14. package/dist/content-types.json +5886 -555
  15. package/dist/core/dist/define-component.d.ts +7 -2
  16. package/dist/core/dist/define-content-type.d.ts +50 -2
  17. package/dist/core/dist/define-content-type.js +107 -3
  18. package/dist/core/dist/define-content-type.js.map +1 -1
  19. package/dist/core/dist/index.d.ts +2 -2
  20. package/dist/docs/access-code-field.md +1 -1
  21. package/dist/docs/access-code-sign-in.md +126 -77
  22. package/dist/docs/account-address-book.md +210 -95
  23. package/dist/docs/account-entry-point.md +4 -4
  24. package/dist/docs/account-menu.md +16 -17
  25. package/dist/docs/account-saved-cards.md +306 -0
  26. package/dist/docs/alert-dialog.md +3 -1
  27. package/dist/docs/avatar.md +4 -2
  28. package/dist/docs/billing-address.md +99 -30
  29. package/dist/docs/binding-switcher.md +157 -0
  30. package/dist/docs/buy-button.md +7 -8
  31. package/dist/docs/card-entry.md +42 -29
  32. package/dist/docs/card-summary.md +185 -0
  33. package/dist/docs/cardholder-document.md +5 -3
  34. package/dist/docs/carousel.md +5 -4
  35. package/dist/docs/cart-destination.md +251 -0
  36. package/dist/docs/cart-item.md +48 -15
  37. package/dist/docs/cart-totalizer.md +8 -6
  38. package/dist/docs/cart.md +240 -39
  39. package/dist/docs/challenge-return.md +135 -0
  40. package/dist/docs/client-preferences-fieldset.md +10 -5
  41. package/dist/docs/client-preferences.md +31 -8
  42. package/dist/docs/client-profile-fieldset.md +20 -6
  43. package/dist/docs/client-profile.md +12 -3
  44. package/dist/docs/copy-text.md +9 -7
  45. package/dist/docs/document-field.md +1 -1
  46. package/dist/docs/email-field.md +2 -1
  47. package/dist/docs/email-identification.md +12 -2
  48. package/dist/docs/footer-copyright.md +4 -2
  49. package/dist/docs/footer-social.md +1 -1
  50. package/dist/docs/form.md +54 -18
  51. package/dist/docs/free-shipping-progress.md +18 -13
  52. package/dist/docs/identity-edit.md +8 -2
  53. package/dist/docs/identity-summary.md +18 -5
  54. package/dist/docs/incentives.md +2 -2
  55. package/dist/docs/installments.md +46 -32
  56. package/dist/docs/logo.md +1 -1
  57. package/dist/docs/my-account-profile.md +16 -11
  58. package/dist/docs/navigation-link.md +5 -3
  59. package/dist/docs/order-cancel.md +3 -1
  60. package/dist/docs/order-delivery-address.md +7 -5
  61. package/dist/docs/order-delivery-group.md +1 -3
  62. package/dist/docs/order-details-back.md +1 -1
  63. package/dist/docs/order-details-header.md +1 -4
  64. package/dist/docs/order-invoice-download.md +60 -0
  65. package/dist/docs/order-list-row.md +1 -1
  66. package/dist/docs/order-list-search.md +13 -20
  67. package/dist/docs/order-list-views.md +11 -17
  68. package/dist/docs/order-list.md +12 -5
  69. package/dist/docs/order-payment.md +9 -7
  70. package/dist/docs/order-placed-date.md +1 -1
  71. package/dist/docs/order-placed-payment-summary.md +28 -15
  72. package/dist/docs/order-placed.md +49 -14
  73. package/dist/docs/order-progress.md +1 -1
  74. package/dist/docs/order-status-badge.md +20 -9
  75. package/dist/docs/order-summary.md +2 -2
  76. package/dist/docs/order-tracking-link.md +58 -0
  77. package/dist/docs/payment-method-badges.md +32 -6
  78. package/dist/docs/payment-methods.md +2 -2
  79. package/dist/docs/payment.md +36 -17
  80. package/dist/docs/phone-field.md +4 -4
  81. package/dist/docs/place-order.md +84 -36
  82. package/dist/docs/postal-code-field.md +3 -1
  83. package/dist/docs/pricing.md +21 -23
  84. package/dist/docs/product-gallery.md +19 -20
  85. package/dist/docs/product-information.md +14 -10
  86. package/dist/docs/product-list.md +7 -6
  87. package/dist/docs/product-shelf.md +7 -1
  88. package/dist/docs/promotion.md +4 -2
  89. package/dist/docs/region.md +23 -15
  90. package/dist/docs/save-card.md +7 -6
  91. package/dist/docs/saved-cards.md +65 -36
  92. package/dist/docs/select.md +3 -4
  93. package/dist/docs/shipping-address.md +57 -21
  94. package/dist/docs/shipping-simulator.md +53 -15
  95. package/dist/docs/sign-in-disclosure.md +176 -0
  96. package/dist/docs/sign-in-form.md +78 -47
  97. package/dist/docs/sign-in-redirect.md +5 -3
  98. package/dist/docs/sign-in.md +173 -0
  99. package/dist/docs/toast.md +45 -16
  100. package/dist/docs/variant-selector.md +15 -11
  101. package/dist/graphql/types.d.ts +4 -14
  102. package/dist/index.d.ts +3 -2
  103. package/dist/internal/client.d.ts +4 -3
  104. package/dist/internal/client.js +5 -2
  105. package/dist/internal/server.d.ts +10 -5
  106. package/dist/internal/server.js +9 -4
  107. package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
  108. package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
  109. package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
  110. package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
  111. package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
  112. package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
  113. package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
  114. package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
  115. package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
  116. package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
  117. package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
  118. package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
  119. package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
  120. package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
  121. package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
  122. package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
  123. package/dist/matter/account-address-book/account-address-book.js +74 -33
  124. package/dist/matter/account-address-book/account-address-book.js.map +1 -1
  125. package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
  126. package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
  127. package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
  128. package/dist/matter/account-address-book/account-address-country.js +83 -49
  129. package/dist/matter/account-address-book/account-address-country.js.map +1 -1
  130. package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
  131. package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
  132. package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
  133. package/dist/matter/account-address-book/account-address-form.js +518 -155
  134. package/dist/matter/account-address-book/account-address-form.js.map +1 -1
  135. package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
  136. package/dist/matter/account-address-book/account-address-record.js +32 -17
  137. package/dist/matter/account-address-book/account-address-record.js.map +1 -1
  138. package/dist/matter/account-menu/account-menu.d.ts +34 -17
  139. package/dist/matter/account-menu/account-menu.js +46 -54
  140. package/dist/matter/account-menu/account-menu.js.map +1 -1
  141. package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
  142. package/dist/matter/account-saved-cards/account-saved-cards.d.ts +463 -0
  143. package/dist/matter/account-saved-cards/account-saved-cards.js +1011 -0
  144. package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -0
  145. package/dist/matter/billing-address/billing-address.d.ts +156 -74
  146. package/dist/matter/billing-address/billing-address.js +227 -156
  147. package/dist/matter/billing-address/billing-address.js.map +1 -1
  148. package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
  149. package/dist/matter/breadcrumb/breadcrumb.js +24 -9
  150. package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
  151. package/dist/matter/buy-button/buy-button.d.ts +8 -11
  152. package/dist/matter/buy-button/buy-button.js +10 -19
  153. package/dist/matter/buy-button/buy-button.js.map +1 -1
  154. package/dist/matter/card-entry/card-capture.js +12 -4
  155. package/dist/matter/card-entry/card-capture.js.map +1 -1
  156. package/dist/matter/card-entry/card-entry.d.ts +123 -32
  157. package/dist/matter/card-entry/card-entry.js +348 -221
  158. package/dist/matter/card-entry/card-entry.js.map +1 -1
  159. package/dist/matter/cart/cart-namespace.d.ts +11 -1
  160. package/dist/matter/cart/cart-namespace.js +11 -1
  161. package/dist/matter/cart/cart-namespace.js.map +1 -1
  162. package/dist/matter/cart/cart.d.ts +416 -45
  163. package/dist/matter/cart/cart.js +782 -101
  164. package/dist/matter/cart/cart.js.map +1 -1
  165. package/dist/matter/cart-destination/cart-destination.d.ts +233 -0
  166. package/dist/matter/cart-destination/cart-destination.js +703 -0
  167. package/dist/matter/cart-destination/cart-destination.js.map +1 -0
  168. package/dist/matter/cart-item/cart-item.d.ts +145 -16
  169. package/dist/matter/cart-item/cart-item.js +230 -54
  170. package/dist/matter/cart-item/cart-item.js.map +1 -1
  171. package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
  172. package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
  173. package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
  174. package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
  175. package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
  176. package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
  177. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
  178. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
  179. package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
  180. package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
  181. package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
  182. package/dist/matter/cart-totalizer/cart-totalizer.js +49 -19
  183. package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
  184. package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
  185. package/dist/matter/challenge-return/challenge-return.js +241 -0
  186. package/dist/matter/challenge-return/challenge-return.js.map +1 -0
  187. package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
  188. package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
  189. package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
  190. package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
  191. package/dist/matter/client-preferences/client-preferences.js +84 -15
  192. package/dist/matter/client-preferences/client-preferences.js.map +1 -1
  193. package/dist/matter/client-profile/client-profile.d.ts +44 -9
  194. package/dist/matter/client-profile/client-profile.js +64 -24
  195. package/dist/matter/client-profile/client-profile.js.map +1 -1
  196. package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
  197. package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
  198. package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
  199. package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
  200. package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
  201. package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
  202. package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
  203. package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
  204. package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
  205. package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
  206. package/dist/matter/delivery-options/delivery-options.js +75 -12
  207. package/dist/matter/delivery-options/delivery-options.js.map +1 -1
  208. package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
  209. package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
  210. package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
  211. package/dist/matter/email-identification/email-identification.d.ts +25 -3
  212. package/dist/matter/email-identification/email-identification.js +49 -12
  213. package/dist/matter/email-identification/email-identification.js.map +1 -1
  214. package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +85 -10
  215. package/dist/matter/free-shipping-progress/free-shipping-progress.js +153 -53
  216. package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
  217. package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
  218. package/dist/matter/identity-edit/identity-edit.js +47 -19
  219. package/dist/matter/identity-edit/identity-edit.js.map +1 -1
  220. package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
  221. package/dist/matter/identity-summary/identity-summary.js +95 -45
  222. package/dist/matter/identity-summary/identity-summary.js.map +1 -1
  223. package/dist/matter/installments/installments-select.d.ts +98 -16
  224. package/dist/matter/installments/installments-select.js +156 -48
  225. package/dist/matter/installments/installments-select.js.map +1 -1
  226. package/dist/matter/installments/installments.d.ts +96 -16
  227. package/dist/matter/installments/installments.js +115 -40
  228. package/dist/matter/installments/installments.js.map +1 -1
  229. package/dist/matter/installments/use-installments-selection.d.ts +1 -0
  230. package/dist/matter/installments/use-installments-selection.js +8 -3
  231. package/dist/matter/installments/use-installments-selection.js.map +1 -1
  232. package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
  233. package/dist/matter/my-account-profile/my-account-profile.js +370 -174
  234. package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
  235. package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
  236. package/dist/matter/order-cancel/order-cancel.js +118 -51
  237. package/dist/matter/order-cancel/order-cancel.js.map +1 -1
  238. package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
  239. package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
  240. package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
  241. package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
  242. package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
  243. package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
  244. package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
  245. package/dist/matter/order-details-header/order-details-header.js +66 -58
  246. package/dist/matter/order-details-header/order-details-header.js.map +1 -1
  247. package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
  248. package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
  249. package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
  250. package/dist/matter/order-list/order-list.d.ts +164 -19
  251. package/dist/matter/order-list/order-list.js +229 -87
  252. package/dist/matter/order-list/order-list.js.map +1 -1
  253. package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
  254. package/dist/matter/order-list-row/order-list-row.js +3 -2
  255. package/dist/matter/order-list-row/order-list-row.js.map +1 -1
  256. package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
  257. package/dist/matter/order-list-search/order-list-search.js +30 -69
  258. package/dist/matter/order-list-search/order-list-search.js.map +1 -1
  259. package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
  260. package/dist/matter/order-list-views/order-list-views.js +22 -68
  261. package/dist/matter/order-list-views/order-list-views.js.map +1 -1
  262. package/dist/matter/order-payment/order-payment.d.ts +33 -10
  263. package/dist/matter/order-payment/order-payment.js +44 -39
  264. package/dist/matter/order-payment/order-payment.js.map +1 -1
  265. package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
  266. package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
  267. package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
  268. package/dist/matter/order-placed/order-placed.d.ts +198 -31
  269. package/dist/matter/order-placed/order-placed.js +230 -139
  270. package/dist/matter/order-placed/order-placed.js.map +1 -1
  271. package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
  272. package/dist/matter/order-placed-date/order-placed-date.js +7 -8
  273. package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
  274. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
  275. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
  276. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
  277. package/dist/matter/order-progress/order-progress.d.ts +19 -8
  278. package/dist/matter/order-progress/order-progress.js +37 -45
  279. package/dist/matter/order-progress/order-progress.js.map +1 -1
  280. package/dist/matter/order-summary/order-summary.d.ts +19 -9
  281. package/dist/matter/order-summary/order-summary.js +38 -44
  282. package/dist/matter/order-summary/order-summary.js.map +1 -1
  283. package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
  284. package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
  285. package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
  286. package/dist/matter/payment/payment-card-capture.js +17 -10
  287. package/dist/matter/payment/payment-card-capture.js.map +1 -1
  288. package/dist/matter/payment/payment-controller.d.ts +4 -2
  289. package/dist/matter/payment/payment-controller.js +30 -9
  290. package/dist/matter/payment/payment-controller.js.map +1 -1
  291. package/dist/matter/payment/payment-method-badges.js +1 -1
  292. package/dist/matter/payment/payment.d.ts +69 -19
  293. package/dist/matter/payment/payment.js +101 -35
  294. package/dist/matter/payment/payment.js.map +1 -1
  295. package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
  296. package/dist/matter/payment/use-payment-method-selection.js +94 -32
  297. package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
  298. package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
  299. package/dist/matter/payment/use-payment-submit-gate.js +47 -8
  300. package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
  301. package/dist/matter/place-order/place-order.d.ts +171 -57
  302. package/dist/matter/place-order/place-order.js +376 -185
  303. package/dist/matter/place-order/place-order.js.map +1 -1
  304. package/dist/matter/pricing/pricing.d.ts +152 -13
  305. package/dist/matter/pricing/pricing.js +153 -52
  306. package/dist/matter/pricing/pricing.js.map +1 -1
  307. package/dist/matter/product-information/product-information.d.ts +27 -4
  308. package/dist/matter/product-information/product-information.js +32 -15
  309. package/dist/matter/product-information/product-information.js.map +1 -1
  310. package/dist/matter/product-list/product-list.d.ts +24 -6
  311. package/dist/matter/product-list/product-list.js +32 -26
  312. package/dist/matter/product-list/product-list.js.map +1 -1
  313. package/dist/matter/product-shelf/product-shelf.d.ts +8 -3
  314. package/dist/matter/product-shelf/product-shelf.js +111 -10
  315. package/dist/matter/product-shelf/product-shelf.js.map +1 -1
  316. package/dist/matter/region/region.d.ts +33 -16
  317. package/dist/matter/region/region.js +59 -52
  318. package/dist/matter/region/region.js.map +1 -1
  319. package/dist/matter/save-card/save-card.d.ts +43 -8
  320. package/dist/matter/save-card/save-card.js +61 -23
  321. package/dist/matter/save-card/save-card.js.map +1 -1
  322. package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
  323. package/dist/matter/saved-cards/saved-cards.js +349 -77
  324. package/dist/matter/saved-cards/saved-cards.js.map +1 -1
  325. package/dist/matter/shipping-address/address-payload.js +25 -0
  326. package/dist/matter/shipping-address/address-payload.js.map +1 -0
  327. package/dist/matter/shipping-address/country-descriptors.js +71 -71
  328. package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
  329. package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
  330. package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
  331. package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
  332. package/dist/matter/shipping-address/shipping-address.js +443 -188
  333. package/dist/matter/shipping-address/shipping-address.js.map +1 -1
  334. package/dist/matter/shipping-simulator/shipping-simulator.d.ts +251 -25
  335. package/dist/matter/shipping-simulator/shipping-simulator.js +261 -51
  336. package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
  337. package/dist/matter/sign-in/sign-in.d.ts +108 -0
  338. package/dist/matter/sign-in/sign-in.js +285 -0
  339. package/dist/matter/sign-in/sign-in.js.map +1 -0
  340. package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
  341. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
  342. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
  343. package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
  344. package/dist/matter/sign-in-form/sign-in-form.js +134 -144
  345. package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
  346. package/dist/particles/binding-switcher/binding-switcher.d.ts +59 -0
  347. package/dist/particles/binding-switcher/binding-switcher.js +194 -0
  348. package/dist/particles/binding-switcher/binding-switcher.js.map +1 -0
  349. package/dist/particles/card-summary/card-network.d.ts +17 -0
  350. package/dist/particles/card-summary/card-network.js +25 -0
  351. package/dist/particles/card-summary/card-network.js.map +1 -0
  352. package/dist/particles/card-summary/card-summary.d.ts +113 -0
  353. package/dist/particles/card-summary/card-summary.js +221 -0
  354. package/dist/particles/card-summary/card-summary.js.map +1 -0
  355. package/dist/particles/carousel/carousel.d.ts +99 -11
  356. package/dist/particles/carousel/carousel.js +103 -35
  357. package/dist/particles/carousel/carousel.js.map +1 -1
  358. package/dist/particles/copy-text/copy-text.js +5 -15
  359. package/dist/particles/copy-text/copy-text.js.map +1 -1
  360. package/dist/particles/dialog/dialog.d.ts +14 -6
  361. package/dist/particles/dialog/dialog.js +6 -3
  362. package/dist/particles/dialog/dialog.js.map +1 -1
  363. package/dist/particles/drawer/drawer.js +1 -1
  364. package/dist/particles/drawer/drawer.js.map +1 -1
  365. package/dist/particles/email-field/email-field.d.ts +2 -1
  366. package/dist/particles/email-field/email-field.js +2 -1
  367. package/dist/particles/email-field/email-field.js.map +1 -1
  368. package/dist/particles/footer-link-group/footer-link-group.js +1 -0
  369. package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
  370. package/dist/particles/footer-social/footer-social.d.ts +1 -1
  371. package/dist/particles/footer-social/footer-social.js +1 -1
  372. package/dist/particles/footer-social/footer-social.js.map +1 -1
  373. package/dist/particles/form/form.d.ts +85 -13
  374. package/dist/particles/form/form.js +91 -42
  375. package/dist/particles/form/form.js.map +1 -1
  376. package/dist/particles/gallery/gallery.d.ts +129 -12
  377. package/dist/particles/gallery/gallery.js +121 -34
  378. package/dist/particles/gallery/gallery.js.map +1 -1
  379. package/dist/particles/incentives/incentives.d.ts +1 -1
  380. package/dist/particles/incentives/incentives.js +1 -1
  381. package/dist/particles/incentives/incentives.js.map +1 -1
  382. package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
  383. package/dist/particles/order-details-back/order-details-back.js +8 -10
  384. package/dist/particles/order-details-back/order-details-back.js.map +1 -1
  385. package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
  386. package/dist/particles/order-status-badge/order-status-badge.js +4 -20
  387. package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
  388. package/dist/particles/password-field/password-field.d.ts +1 -1
  389. package/dist/particles/password-field/password-field.js +2 -4
  390. package/dist/particles/password-field/password-field.js.map +1 -1
  391. package/dist/particles/payment-methods/payment-methods.d.ts +1 -1
  392. package/dist/particles/payment-methods/payment-methods.js +1 -1
  393. package/dist/particles/payment-methods/payment-methods.js.map +1 -1
  394. package/dist/particles/phone-field/phone-field.d.ts +4 -4
  395. package/dist/particles/phone-field/phone-field.js +8 -11
  396. package/dist/particles/phone-field/phone-field.js.map +1 -1
  397. package/dist/particles/spinner/spinner.d.ts +24 -4
  398. package/dist/particles/spinner/spinner.js +25 -9
  399. package/dist/particles/spinner/spinner.js.map +1 -1
  400. package/dist/particles/switch/switch.d.ts +4 -1
  401. package/dist/particles/switch/switch.js +3 -1
  402. package/dist/particles/switch/switch.js.map +1 -1
  403. package/dist/particles/toast/toast.d.ts +49 -9
  404. package/dist/particles/toast/toast.js +81 -15
  405. package/dist/particles/toast/toast.js.map +1 -1
  406. package/dist/schema.graphql +461 -89
  407. package/dist/sdk/actions/index.d.ts +3 -1
  408. package/dist/sdk/actions/index.js +3 -1
  409. package/dist/sdk/actions/locale-action-provider.d.ts +16 -0
  410. package/dist/sdk/actions/locale-action-provider.js +20 -0
  411. package/dist/sdk/actions/locale-action-provider.js.map +1 -0
  412. package/dist/sdk/actions/saved-card-action-provider.d.ts +12 -0
  413. package/dist/sdk/actions/saved-card-action-provider.js +16 -0
  414. package/dist/sdk/actions/saved-card-action-provider.js.map +1 -0
  415. package/dist/sdk/actions/types.d.ts +6 -2
  416. package/dist/sdk/address/address-fields.js +4 -4
  417. package/dist/sdk/address/address-fields.js.map +1 -1
  418. package/dist/sdk/address/constants.js +1 -6
  419. package/dist/sdk/address/constants.js.map +1 -1
  420. package/dist/sdk/address/messages.js +44 -44
  421. package/dist/sdk/address/messages.js.map +1 -1
  422. package/dist/sdk/address/postal-code.js +15 -2
  423. package/dist/sdk/address/postal-code.js.map +1 -1
  424. package/dist/sdk/address/types.d.ts +5 -3
  425. package/dist/sdk/address/validate-address.js +3 -3
  426. package/dist/sdk/address/validate-address.js.map +1 -1
  427. package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
  428. package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
  429. package/dist/sdk/cache/storefront-cache.js +2 -1
  430. package/dist/sdk/cache/storefront-cache.js.map +1 -1
  431. package/dist/sdk/cart/operations.d.ts +2 -1
  432. package/dist/sdk/cart/operations.js +55 -1
  433. package/dist/sdk/cart/operations.js.map +1 -1
  434. package/dist/sdk/cart/optimistic.d.ts +30 -7
  435. package/dist/sdk/cart/optimistic.js +78 -41
  436. package/dist/sdk/cart/optimistic.js.map +1 -1
  437. package/dist/sdk/cart/use-cart-actions.d.ts +7 -0
  438. package/dist/sdk/cart/use-cart-actions.js +61 -15
  439. package/dist/sdk/cart/use-cart-actions.js.map +1 -1
  440. package/dist/sdk/cart/use-cart-sync-sales-channel.js +70 -0
  441. package/dist/sdk/cart/use-cart-sync-sales-channel.js.map +1 -0
  442. package/dist/sdk/data/index.js +2 -2
  443. package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
  444. package/dist/sdk/generated/gql.js +16 -12
  445. package/dist/sdk/generated/gql.js.map +1 -1
  446. package/dist/sdk/generated/graphql.d.ts +197 -51
  447. package/dist/sdk/generated/graphql.js +2318 -91
  448. package/dist/sdk/generated/graphql.js.map +1 -1
  449. package/dist/sdk/i18n/format-error-code.js +23 -0
  450. package/dist/sdk/i18n/format-error-code.js.map +1 -0
  451. package/dist/sdk/i18n/message-formatter.d.ts +22 -0
  452. package/dist/sdk/i18n/message-formatter.js +140 -0
  453. package/dist/sdk/i18n/message-formatter.js.map +1 -0
  454. package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
  455. package/dist/sdk/i18n/use-message-formatter.js +18 -0
  456. package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
  457. package/dist/sdk/identity/use-identity-actions.js.map +1 -1
  458. package/dist/sdk/locale/binding-switch-provider.d.ts +13 -0
  459. package/dist/sdk/locale/binding-switch-provider.js +20 -0
  460. package/dist/sdk/locale/binding-switch-provider.js.map +1 -0
  461. package/dist/sdk/locale/use-locale-actions.d.ts +16 -0
  462. package/dist/sdk/locale/use-locale-actions.js +70 -0
  463. package/dist/sdk/locale/use-locale-actions.js.map +1 -0
  464. package/dist/sdk/navigation/binding-switch.d.ts +39 -0
  465. package/dist/sdk/navigation/binding-switch.js +129 -0
  466. package/dist/sdk/navigation/binding-switch.js.map +1 -0
  467. package/dist/sdk/navigation/decode-route-params.d.ts +11 -0
  468. package/dist/sdk/navigation/decode-route-params.js +32 -0
  469. package/dist/sdk/navigation/decode-route-params.js.map +1 -0
  470. package/dist/sdk/navigation/redirect.d.ts +2 -0
  471. package/dist/sdk/navigation/redirect.js +19 -1
  472. package/dist/sdk/navigation/redirect.js.map +1 -1
  473. package/dist/sdk/navigation/types.d.ts +13 -0
  474. package/dist/sdk/payment/bin-format.js +20 -0
  475. package/dist/sdk/payment/bin-format.js.map +1 -0
  476. package/dist/sdk/payment/challenge-return.js +37 -0
  477. package/dist/sdk/payment/challenge-return.js.map +1 -0
  478. package/dist/sdk/payment/confirmation-last-four.js +39 -0
  479. package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
  480. package/dist/sdk/payment/gateway.d.ts +1 -1
  481. package/dist/sdk/payment/gateway.js +8 -2
  482. package/dist/sdk/payment/gateway.js.map +1 -1
  483. package/dist/sdk/payment/operations.d.ts +1 -0
  484. package/dist/sdk/payment/operations.js +28 -6
  485. package/dist/sdk/payment/operations.js.map +1 -1
  486. package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
  487. package/dist/sdk/payment/resumed-purchase.js +119 -0
  488. package/dist/sdk/payment/resumed-purchase.js.map +1 -0
  489. package/dist/sdk/payment/security-code-mask.js +16 -23
  490. package/dist/sdk/payment/security-code-mask.js.map +1 -1
  491. package/dist/sdk/payment/submission-registry.js +6 -2
  492. package/dist/sdk/payment/submission-registry.js.map +1 -1
  493. package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
  494. package/dist/sdk/payment/use-payment-actions.js +23 -3
  495. package/dist/sdk/payment/use-payment-actions.js.map +1 -1
  496. package/dist/sdk/payment/use-place-order.d.ts +10 -2
  497. package/dist/sdk/payment/use-place-order.js +138 -76
  498. package/dist/sdk/payment/use-place-order.js.map +1 -1
  499. package/dist/sdk/provider/storefront-provider.d.ts +1 -7
  500. package/dist/sdk/provider/storefront-provider.js +4 -11
  501. package/dist/sdk/provider/storefront-provider.js.map +1 -1
  502. package/dist/sdk/saved-cards/operations.d.ts +16 -0
  503. package/dist/sdk/saved-cards/operations.js +41 -0
  504. package/dist/sdk/saved-cards/operations.js.map +1 -0
  505. package/dist/sdk/saved-cards/use-saved-card-actions.d.ts +26 -0
  506. package/dist/sdk/saved-cards/use-saved-card-actions.js +86 -0
  507. package/dist/sdk/saved-cards/use-saved-card-actions.js.map +1 -0
  508. package/dist/sdk/seo/entity-landing.d.ts +24 -0
  509. package/dist/sdk/seo/entity-landing.js +30 -0
  510. package/dist/sdk/seo/entity-landing.js.map +1 -0
  511. package/dist/sdk/seo/page-alternates.d.ts +8 -5
  512. package/dist/sdk/seo/page-alternates.js +11 -14
  513. package/dist/sdk/seo/page-alternates.js.map +1 -1
  514. package/dist/sdk/seo/search-landing.d.ts +42 -0
  515. package/dist/sdk/seo/search-landing.js +85 -0
  516. package/dist/sdk/seo/search-landing.js.map +1 -0
  517. package/dist/sdk/session/mock-session.d.ts +9 -0
  518. package/dist/sdk/session/mock-session.js +31 -0
  519. package/dist/sdk/session/mock-session.js.map +1 -0
  520. package/dist/sdk/session/read-server-session.d.ts +3 -0
  521. package/dist/sdk/session/read-server-session.js +5 -0
  522. package/dist/sdk/session/read-server-session.js.map +1 -1
  523. package/dist/sdk/session/return-path-segment.d.ts +10 -0
  524. package/dist/sdk/session/return-path-segment.js +15 -0
  525. package/dist/sdk/session/return-path-segment.js.map +1 -0
  526. package/dist/sdk/session/use-session-actions.js.map +1 -1
  527. package/dist/sdk/shipping/shipping-operations.d.ts +1 -1
  528. package/dist/sdk/shipping/shipping-operations.js +13 -0
  529. package/dist/sdk/shipping/shipping-operations.js.map +1 -1
  530. package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
  531. package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
  532. package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
  533. package/dist/sdk/state/cart.d.ts +9 -2
  534. package/dist/sdk/state/cart.js +9 -2
  535. package/dist/sdk/state/cart.js.map +1 -1
  536. package/dist/utils/safe-href.d.ts +2 -0
  537. package/package.json +4 -3
  538. package/skills/storefront-asset/SKILL.md +2 -2
  539. package/skills/storefront-asset/references/api-side.md +27 -14
  540. package/skills/storefront-asset/references/findings.md +5 -2
  541. package/src/styles/tailwind.css +9 -2
  542. package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
  543. package/dist/message-locales.json +0 -7
  544. package/dist/sdk/i18n/client.d.ts +0 -4
  545. package/dist/sdk/i18n/client.js +0 -4
  546. package/dist/sdk/i18n/locales.d.ts +0 -8
  547. package/dist/sdk/i18n/locales.js +0 -57
  548. package/dist/sdk/i18n/locales.js.map +0 -1
  549. package/dist/sdk/i18n/messages/en-US.js +0 -164
  550. package/dist/sdk/i18n/messages/en-US.js.map +0 -1
  551. package/dist/sdk/i18n/messages/en-US.json +0 -159
  552. package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -163
  553. package/dist/sdk/i18n/messages/es-ES.js +0 -164
  554. package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
  555. package/dist/sdk/i18n/messages/es-ES.json +0 -159
  556. package/dist/sdk/i18n/messages/pt-BR.js +0 -164
  557. package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
  558. package/dist/sdk/i18n/messages/pt-BR.json +0 -159
  559. package/dist/sdk/i18n/provider.d.ts +0 -1
  560. package/dist/sdk/i18n/provider.js +0 -30
  561. package/dist/sdk/i18n/provider.js.map +0 -1
  562. package/dist/sdk/i18n/server.d.ts +0 -28
  563. package/dist/sdk/i18n/server.js +0 -59
  564. package/dist/sdk/i18n/server.js.map +0 -1
  565. package/dist/utils/resolve-authored-copy.js +0 -18
  566. package/dist/utils/resolve-authored-copy.js.map +0 -1
  567. package/dist/utils/substitute-template.js +0 -33
  568. package/dist/utils/substitute-template.js.map +0 -1
@@ -1,7 +1,94 @@
1
+ import { ContentValue, MessageLocaleProp } from "../../core/dist/define-content-type.js";
1
2
  import { ComponentDefinition } from "../../core/dist/define-component.js";
2
3
  import "../../core/dist/index.js";
3
4
  import { ComponentPropsWithRef, ReactNode } from "react";
4
5
  //#region src/particles/carousel/carousel.d.ts
6
+ export declare const CarouselRootContent: {
7
+ readonly id: "carousel-root";
8
+ readonly title: "Carousel Root";
9
+ readonly description: "Accessible name of the carousel region.";
10
+ readonly schema: {
11
+ readonly type: "object";
12
+ readonly additionalProperties: false;
13
+ readonly properties: {
14
+ readonly label: {
15
+ readonly type: "string";
16
+ readonly title: "Accessible label";
17
+ readonly format: "icu-message";
18
+ readonly messageSource: "Carousel";
19
+ };
20
+ };
21
+ };
22
+ };
23
+ export declare const CarouselPreviousContent: {
24
+ readonly id: "carousel-previous";
25
+ readonly title: "Carousel Previous";
26
+ readonly description: "Accessible name of the previous-page control.";
27
+ readonly schema: {
28
+ readonly type: "object";
29
+ readonly additionalProperties: false;
30
+ readonly properties: {
31
+ readonly label: {
32
+ readonly type: "string";
33
+ readonly title: "Accessible label";
34
+ readonly format: "icu-message";
35
+ readonly messageSource: "Previous";
36
+ };
37
+ };
38
+ };
39
+ };
40
+ export declare const CarouselNextContent: {
41
+ readonly id: "carousel-next";
42
+ readonly title: "Carousel Next";
43
+ readonly description: "Accessible name of the next-page control.";
44
+ readonly schema: {
45
+ readonly type: "object";
46
+ readonly additionalProperties: false;
47
+ readonly properties: {
48
+ readonly label: {
49
+ readonly type: "string";
50
+ readonly title: "Accessible label";
51
+ readonly format: "icu-message";
52
+ readonly messageSource: "Next";
53
+ };
54
+ };
55
+ };
56
+ };
57
+ export declare const CarouselBulletsContent: {
58
+ readonly id: "carousel-bullets";
59
+ readonly title: "Carousel Bullets";
60
+ readonly description: "Accessible names of the page bullets and of their group.";
61
+ readonly schema: {
62
+ readonly type: "object";
63
+ readonly additionalProperties: false;
64
+ readonly properties: {
65
+ readonly ariaLabel: {
66
+ readonly type: "string";
67
+ readonly title: "Group accessible label";
68
+ readonly format: "icu-message";
69
+ readonly messageSource: "Choose page";
70
+ };
71
+ readonly bulletLabel: {
72
+ readonly type: "string";
73
+ readonly title: "Bullet accessible label";
74
+ readonly description: "The page argument is the 1-based page number.";
75
+ readonly format: "icu-message";
76
+ readonly messageSource: "Go to page {page}";
77
+ readonly messageArguments: {
78
+ readonly type: "object";
79
+ readonly properties: {
80
+ readonly page: {
81
+ readonly type: "integer";
82
+ };
83
+ };
84
+ };
85
+ readonly messageExample: {
86
+ readonly page: 2;
87
+ };
88
+ };
89
+ };
90
+ };
91
+ };
5
92
  export type CarouselVariant = 'slide' | 'scroll';
6
93
  export type CarouselContextValue = {
7
94
  currentPage: number;
@@ -17,33 +104,34 @@ export type CarouselContextValue = {
17
104
  canGoPrevious: boolean;
18
105
  setItemCount: (count: number) => void;
19
106
  };
20
- export type CarouselRootProps = ComponentPropsWithRef<'section'> & {
107
+ export type CarouselRootProps = ComponentPropsWithRef<'section'> & MessageLocaleProp & {
21
108
  infiniteMode?: boolean;
22
109
  variant?: CarouselVariant;
23
110
  itemsPerPage?: number;
24
111
  defaultPage?: number;
25
- label?: string;
112
+ $content?: ContentValue<typeof CarouselRootContent>;
26
113
  };
27
114
  export type CarouselTrackProps = ComponentPropsWithRef<'div'> & {
28
115
  children?: ReactNode;
29
116
  };
30
- export type CarouselPreviousProps = ComponentPropsWithRef<'button'> & {
117
+ export type CarouselPreviousProps = ComponentPropsWithRef<'button'> & MessageLocaleProp & {
31
118
  children?: ReactNode;
119
+ $content?: ContentValue<typeof CarouselPreviousContent>;
32
120
  };
33
- export type CarouselNextProps = ComponentPropsWithRef<'button'> & {
121
+ export type CarouselNextProps = ComponentPropsWithRef<'button'> & MessageLocaleProp & {
34
122
  children?: ReactNode;
123
+ $content?: ContentValue<typeof CarouselNextContent>;
35
124
  };
36
- export type CarouselBulletsProps = ComponentPropsWithRef<'div'> & {
37
- ariaLabel?: string;
38
- bulletLabel?: string;
125
+ export type CarouselBulletsProps = ComponentPropsWithRef<'div'> & MessageLocaleProp & {
39
126
  hideWhenSingle?: boolean;
127
+ $content?: ContentValue<typeof CarouselBulletsContent>;
40
128
  };
41
129
  export declare function useCarousel(): CarouselContextValue;
42
- export declare function CarouselRoot({ infiniteMode, variant, itemsPerPage, defaultPage, label, children, ...props }: CarouselRootProps): import("react/jsx-runtime").JSX.Element;
130
+ export declare function CarouselRoot({ infiniteMode, variant, itemsPerPage, defaultPage, $locale, $content, children, ...props }: CarouselRootProps): import("react/jsx-runtime").JSX.Element;
43
131
  export declare function CarouselTrack({ children, style, ref, onScroll, ...props }: CarouselTrackProps): import("react/jsx-runtime").JSX.Element;
44
- export declare function CarouselPrevious({ children, onClick, ...props }: CarouselPreviousProps): import("react/jsx-runtime").JSX.Element;
45
- export declare function CarouselNext({ children, onClick, ...props }: CarouselNextProps): import("react/jsx-runtime").JSX.Element;
46
- export declare function CarouselBullets({ ariaLabel, bulletLabel, hideWhenSingle, ...props }: CarouselBulletsProps): import("react/jsx-runtime").JSX.Element | null;
132
+ export declare function CarouselPrevious({ $locale, $content, children, onClick, ...props }: CarouselPreviousProps): import("react/jsx-runtime").JSX.Element;
133
+ export declare function CarouselNext({ $locale, $content, children, onClick, ...props }: CarouselNextProps): import("react/jsx-runtime").JSX.Element;
134
+ export declare function CarouselBullets({ $locale, $content, hideWhenSingle, ...props }: CarouselBulletsProps): import("react/jsx-runtime").JSX.Element | null;
47
135
  export declare const CarouselRootDefinition: ComponentDefinition<CarouselRootProps>;
48
136
  export declare const CarouselTrackDefinition: ComponentDefinition<CarouselTrackProps>;
49
137
  export declare const CarouselPreviousDefinition: ComponentDefinition<CarouselPreviousProps>;
@@ -1,16 +1,93 @@
1
1
  "use client";
2
2
  import { defineComponent } from "../../core/dist/define-component.js";
3
+ import { defineContentType } from "../../core/dist/define-content-type.js";
3
4
  import "../../core/dist/index.js";
5
+ import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
4
6
  import { Children, createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
5
7
  import { jsx } from "react/jsx-runtime";
6
8
  //#region src/particles/carousel/carousel.tsx
9
+ const CarouselRootContent = defineContentType({
10
+ id: "carousel-root",
11
+ title: "Carousel Root",
12
+ description: "Accessible name of the carousel region.",
13
+ schema: {
14
+ type: "object",
15
+ additionalProperties: false,
16
+ properties: { label: {
17
+ type: "string",
18
+ title: "Accessible label",
19
+ format: "icu-message",
20
+ messageSource: "Carousel"
21
+ } }
22
+ }
23
+ });
24
+ const CarouselPreviousContent = defineContentType({
25
+ id: "carousel-previous",
26
+ title: "Carousel Previous",
27
+ description: "Accessible name of the previous-page control.",
28
+ schema: {
29
+ type: "object",
30
+ additionalProperties: false,
31
+ properties: { label: {
32
+ type: "string",
33
+ title: "Accessible label",
34
+ format: "icu-message",
35
+ messageSource: "Previous"
36
+ } }
37
+ }
38
+ });
39
+ const CarouselNextContent = defineContentType({
40
+ id: "carousel-next",
41
+ title: "Carousel Next",
42
+ description: "Accessible name of the next-page control.",
43
+ schema: {
44
+ type: "object",
45
+ additionalProperties: false,
46
+ properties: { label: {
47
+ type: "string",
48
+ title: "Accessible label",
49
+ format: "icu-message",
50
+ messageSource: "Next"
51
+ } }
52
+ }
53
+ });
54
+ const CarouselBulletsContent = defineContentType({
55
+ id: "carousel-bullets",
56
+ title: "Carousel Bullets",
57
+ description: "Accessible names of the page bullets and of their group.",
58
+ schema: {
59
+ type: "object",
60
+ additionalProperties: false,
61
+ properties: {
62
+ ariaLabel: {
63
+ type: "string",
64
+ title: "Group accessible label",
65
+ format: "icu-message",
66
+ messageSource: "Choose page"
67
+ },
68
+ bulletLabel: {
69
+ type: "string",
70
+ title: "Bullet accessible label",
71
+ description: "The page argument is the 1-based page number.",
72
+ format: "icu-message",
73
+ messageSource: "Go to page {page}",
74
+ messageArguments: {
75
+ type: "object",
76
+ properties: { page: { type: "integer" } }
77
+ },
78
+ messageExample: { page: 2 }
79
+ }
80
+ }
81
+ }
82
+ });
7
83
  const CarouselContext = createContext(null);
8
84
  function useCarousel() {
9
85
  const ctx = useContext(CarouselContext);
10
86
  if (!ctx) throw new Error("Carousel components must be used inside CarouselRoot.");
11
87
  return ctx;
12
88
  }
13
- function CarouselRoot({ infiniteMode = false, variant = "slide", itemsPerPage = 1, defaultPage = 0, label = "Carousel", children, ...props }) {
89
+ function CarouselRoot({ infiniteMode = false, variant = "slide", itemsPerPage = 1, defaultPage = 0, $locale, $content, children, ...props }) {
90
+ const messages = useMessageFormatter(CarouselRootContent, $content);
14
91
  const [currentPage, setCurrentPage] = useState(defaultPage);
15
92
  const [itemCount, setItemCountState] = useState(0);
16
93
  const perPage = Math.max(1, itemsPerPage);
@@ -67,7 +144,7 @@ function CarouselRoot({ infiniteMode = false, variant = "slide", itemsPerPage =
67
144
  "data-fs-carousel": "",
68
145
  "data-fs-carousel-variant": variant,
69
146
  "aria-roledescription": "carousel",
70
- "aria-label": label,
147
+ "aria-label": messages.format("label"),
71
148
  children
72
149
  })
73
150
  });
@@ -152,8 +229,9 @@ function CarouselTrack({ children, style, ref, onScroll, ...props }) {
152
229
  })
153
230
  });
154
231
  }
155
- function CarouselPrevious({ children, onClick, ...props }) {
232
+ function CarouselPrevious({ $locale, $content, children, onClick, ...props }) {
156
233
  const { previous, canGoPrevious } = useCarousel();
234
+ const messages = useMessageFormatter(CarouselPreviousContent, $content);
157
235
  return /* @__PURE__ */ jsx("button", {
158
236
  type: "button",
159
237
  disabled: !canGoPrevious,
@@ -161,14 +239,15 @@ function CarouselPrevious({ children, onClick, ...props }) {
161
239
  onClick?.(event);
162
240
  if (!event.defaultPrevented) previous();
163
241
  },
164
- "aria-label": "Previous",
242
+ "aria-label": messages.format("label"),
165
243
  "data-fs-carousel-previous": "",
166
244
  ...props,
167
245
  children
168
246
  });
169
247
  }
170
- function CarouselNext({ children, onClick, ...props }) {
248
+ function CarouselNext({ $locale, $content, children, onClick, ...props }) {
171
249
  const { next, canGoNext } = useCarousel();
250
+ const messages = useMessageFormatter(CarouselNextContent, $content);
172
251
  return /* @__PURE__ */ jsx("button", {
173
252
  type: "button",
174
253
  disabled: !canGoNext,
@@ -176,15 +255,17 @@ function CarouselNext({ children, onClick, ...props }) {
176
255
  onClick?.(event);
177
256
  if (!event.defaultPrevented) next();
178
257
  },
179
- "aria-label": "Next",
258
+ "aria-label": messages.format("label"),
180
259
  "data-fs-carousel-next": "",
181
260
  ...props,
182
261
  children
183
262
  });
184
263
  }
185
- function CarouselBullets({ ariaLabel = "Choose page", bulletLabel = "Go to page {page}", hideWhenSingle = true, ...props }) {
264
+ function CarouselBullets({ $locale, $content, hideWhenSingle = true, ...props }) {
186
265
  const { totalPages, currentPage, goToPage } = useCarousel();
266
+ const messages = useMessageFormatter(CarouselBulletsContent, $content);
187
267
  if (hideWhenSingle && totalPages <= 1) return null;
268
+ const ariaLabel = messages.format("ariaLabel");
188
269
  function handleKeyDown(event, page) {
189
270
  let target = page;
190
271
  switch (event.key) {
@@ -215,7 +296,7 @@ function CarouselBullets({ ariaLabel = "Choose page", bulletLabel = "Go to page
215
296
  const isActive = page === currentPage;
216
297
  return /* @__PURE__ */ jsx("button", {
217
298
  type: "button",
218
- "aria-label": bulletLabel.replace("{page}", String(page + 1)),
299
+ "aria-label": messages.format("bulletLabel", { page: page + 1 }),
219
300
  "aria-current": isActive,
220
301
  "data-fs-carousel-bullet": "",
221
302
  "data-fs-carousel-bullet-selected": String(isActive),
@@ -229,6 +310,7 @@ const CarouselRootDefinition = defineComponent({
229
310
  name: "CarouselRoot",
230
311
  importPath: "@vtex/faststore/components",
231
312
  component: CarouselRoot,
313
+ content: CarouselRootContent,
232
314
  editor: {
233
315
  label: "Carousel Root",
234
316
  category: "layout"
@@ -253,14 +335,9 @@ const CarouselRootDefinition = defineComponent({
253
335
  type: "number",
254
336
  default: 0,
255
337
  label: "Default Page"
256
- },
257
- label: {
258
- type: "string",
259
- default: "Carousel",
260
- label: "Aria Label"
261
338
  }
262
339
  },
263
- guideline: "Root of the carousel. Provides paging state to all parts. Compose as: CarouselRoot > (CarouselTrack > [item children] + CarouselPrevious + CarouselNext + CarouselBullets). Set infiniteMode=true to loop seamlessly (arrows never disable); variant=\"scroll\" for native overflow, \"slide\" for transform transitions. itemsPerPage sets how many children are visible per page. Holds no product or media data — nest any children in CarouselTrack."
340
+ guideline: "Root of the carousel. Provides paging state to all parts. Compose as: CarouselRoot > (CarouselTrack > [item children] + CarouselPrevious + CarouselNext + CarouselBullets). Set infiniteMode=true to loop seamlessly (arrows never disable); variant=\"scroll\" for native overflow, \"slide\" for transform transitions. itemsPerPage sets how many children are visible per page. Its accessible name comes from the $content field label. Holds no product or media data — nest any children in CarouselTrack."
264
341
  });
265
342
  const CarouselTrackDefinition = defineComponent({
266
343
  name: "CarouselTrack",
@@ -277,50 +354,41 @@ const CarouselPreviousDefinition = defineComponent({
277
354
  name: "CarouselPrevious",
278
355
  importPath: "@vtex/faststore/components",
279
356
  component: CarouselPrevious,
357
+ content: CarouselPreviousContent,
280
358
  editor: {
281
359
  label: "Carousel Previous",
282
360
  category: "action"
283
361
  },
284
362
  schema: {},
285
- guideline: "Moves the track one page backward. Disabled on the first page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the last page). Accepts any children (Icon, text). Must be inside CarouselRoot."
363
+ guideline: "Moves the track one page backward. Disabled on the first page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the last page). Accepts any children (Icon, text); its accessible name comes from the $content field label. Must be inside CarouselRoot."
286
364
  });
287
365
  const CarouselNextDefinition = defineComponent({
288
366
  name: "CarouselNext",
289
367
  importPath: "@vtex/faststore/components",
290
368
  component: CarouselNext,
369
+ content: CarouselNextContent,
291
370
  editor: {
292
371
  label: "Carousel Next",
293
372
  category: "action"
294
373
  },
295
374
  schema: {},
296
- guideline: "Moves the track one page forward. Disabled on the last page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the first page). Accepts any children (Icon, text). Must be inside CarouselRoot."
375
+ guideline: "Moves the track one page forward. Disabled on the last page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the first page). Accepts any children (Icon, text); its accessible name comes from the $content field label. Must be inside CarouselRoot."
297
376
  });
298
377
  const CarouselBulletsDefinition = defineComponent({
299
378
  name: "CarouselBullets",
300
379
  importPath: "@vtex/faststore/components",
301
380
  component: CarouselBullets,
381
+ content: CarouselBulletsContent,
302
382
  editor: {
303
383
  label: "Carousel Bullets",
304
384
  category: "action"
305
385
  },
306
- schema: {
307
- ariaLabel: {
308
- type: "string",
309
- default: "Choose page",
310
- label: "Aria Label"
311
- },
312
- bulletLabel: {
313
- type: "string",
314
- default: "Go to page {page}",
315
- label: "Bullet Label Template"
316
- },
317
- hideWhenSingle: {
318
- type: "boolean",
319
- default: true,
320
- label: "Hide when single page"
321
- }
322
- },
323
- guideline: "Renders one bullet button per page and marks the active page. Supports ArrowLeft/ArrowRight/Home/End keyboard navigation. Returns null when there is a single page unless hideWhenSingle={false}. Use {page} in bulletLabel for the 1-based page number. Must be inside CarouselRoot."
386
+ schema: { hideWhenSingle: {
387
+ type: "boolean",
388
+ default: true,
389
+ label: "Hide when single page"
390
+ } },
391
+ guideline: "Renders one bullet button per page and marks the active page. Supports ArrowLeft/ArrowRight/Home/End keyboard navigation. Returns null when there is a single page unless hideWhenSingle={false}. The group accessible name is the $content field ariaLabel; each bullet takes bulletLabel, whose page argument is the 1-based page number. Must be inside CarouselRoot."
324
392
  });
325
393
  const Carousel = {
326
394
  Root: CarouselRoot,
@@ -330,6 +398,6 @@ const Carousel = {
330
398
  Bullets: CarouselBullets
331
399
  };
332
400
  //#endregion
333
- export { Carousel, CarouselBullets, CarouselBulletsDefinition, CarouselNext, CarouselNextDefinition, CarouselPrevious, CarouselPreviousDefinition, CarouselRoot, CarouselRootDefinition, CarouselTrack, CarouselTrackDefinition, useCarousel };
401
+ export { Carousel, CarouselBullets, CarouselBulletsContent, CarouselBulletsDefinition, CarouselNext, CarouselNextContent, CarouselNextDefinition, CarouselPrevious, CarouselPreviousContent, CarouselPreviousDefinition, CarouselRoot, CarouselRootContent, CarouselRootDefinition, CarouselTrack, CarouselTrackDefinition, useCarousel };
334
402
 
335
403
  //# sourceMappingURL=carousel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.js","names":[],"sources":["../../../src/particles/carousel/carousel.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport {\n Children,\n type ComponentPropsWithRef,\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nexport type CarouselVariant = 'slide' | 'scroll';\n\nexport type CarouselContextValue = {\n currentPage: number;\n itemCount: number;\n itemsPerPage: number;\n totalPages: number;\n variant: CarouselVariant;\n infiniteMode: boolean;\n goToPage: (page: number) => void;\n next: () => void;\n previous: () => void;\n canGoNext: boolean;\n canGoPrevious: boolean;\n setItemCount: (count: number) => void;\n};\n\nexport type CarouselRootProps = ComponentPropsWithRef<'section'> & {\n infiniteMode?: boolean;\n variant?: CarouselVariant;\n itemsPerPage?: number;\n defaultPage?: number;\n label?: string;\n};\n\nexport type CarouselTrackProps = ComponentPropsWithRef<'div'> & {\n children?: ReactNode;\n};\n\nexport type CarouselPreviousProps = ComponentPropsWithRef<'button'> & {\n children?: ReactNode;\n};\n\nexport type CarouselNextProps = ComponentPropsWithRef<'button'> & {\n children?: ReactNode;\n};\n\nexport type CarouselBulletsProps = ComponentPropsWithRef<'div'> & {\n ariaLabel?: string;\n bulletLabel?: string;\n hideWhenSingle?: boolean;\n};\n\nconst CarouselContext = createContext<CarouselContextValue | null>(null);\n\nexport function useCarousel(): CarouselContextValue {\n const ctx = useContext(CarouselContext);\n if (!ctx) throw new Error('Carousel components must be used inside CarouselRoot.');\n return ctx;\n}\n\nexport function CarouselRoot({\n infiniteMode = false,\n variant = 'slide',\n itemsPerPage = 1,\n defaultPage = 0,\n label = 'Carousel',\n children,\n ...props\n}: CarouselRootProps) {\n const [currentPage, setCurrentPage] = useState(defaultPage);\n const [itemCount, setItemCountState] = useState(0);\n\n const perPage = Math.max(1, itemsPerPage);\n const totalPages = Math.max(1, Math.ceil(itemCount / perPage));\n\n const setItemCount = useCallback((count: number) => {\n setItemCountState((prev) => (prev === count ? prev : count));\n }, []);\n\n // Keep the current page in range when the number of pages shrinks.\n useEffect(() => {\n if (itemCount === 0) return;\n setCurrentPage((page) => Math.min(page, totalPages - 1));\n }, [itemCount, totalPages]);\n\n const goToPage = useCallback(\n (page: number) => {\n setCurrentPage(Math.max(0, Math.min(page, totalPages - 1)));\n },\n [totalPages],\n );\n\n const next = useCallback(() => {\n setCurrentPage((page) => (infiniteMode ? (page + 1) % totalPages : Math.min(page + 1, totalPages - 1)));\n }, [infiniteMode, totalPages]);\n\n const previous = useCallback(() => {\n setCurrentPage((page) => (infiniteMode ? (page - 1 + totalPages) % totalPages : Math.max(page - 1, 0)));\n }, [infiniteMode, totalPages]);\n\n const canGoNext = infiniteMode ? totalPages > 1 : currentPage < totalPages - 1;\n const canGoPrevious = infiniteMode ? totalPages > 1 : currentPage > 0;\n\n const ctx = useMemo<CarouselContextValue>(\n () => ({\n currentPage,\n itemCount,\n itemsPerPage: perPage,\n totalPages,\n variant,\n infiniteMode,\n goToPage,\n next,\n previous,\n canGoNext,\n canGoPrevious,\n setItemCount,\n }),\n [\n currentPage,\n itemCount,\n perPage,\n totalPages,\n variant,\n infiniteMode,\n goToPage,\n next,\n previous,\n canGoNext,\n canGoPrevious,\n setItemCount,\n ],\n );\n\n return (\n <CarouselContext value={ctx}>\n <section\n {...props}\n data-fs-carousel=\"\"\n data-fs-carousel-variant={variant}\n aria-roledescription=\"carousel\"\n aria-label={label}\n >\n {children}\n </section>\n </CarouselContext>\n );\n}\n\nexport function CarouselTrack({ children, style, ref, onScroll, ...props }: CarouselTrackProps) {\n const { setItemCount, itemsPerPage, currentPage, variant, goToPage } = useCarousel();\n const items = Children.toArray(children);\n const count = items.length;\n const scrollRef = useRef<HTMLDivElement>(null);\n // True while an internal scrollTo animation runs, so the native scroll events it emits do not\n // feed back into goToPage and fight the animation. Cleared once the target page is reached.\n const programmaticScroll = useRef(false);\n\n // Scroll mode needs the internal scrollRef to drive scrollTo, but must still honor a\n // consumer-forwarded ref (the slide branch gets it for free through the element).\n const mergedScrollRef = useCallback(\n (node: HTMLDivElement | null) => {\n scrollRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n\n useEffect(() => {\n setItemCount(count);\n }, [count, setItemCount]);\n\n // In scroll mode the track is the native scroll container; move it to the current page unless it\n // is already there (e.g. the user just scrolled), so a programmatic scroll never fights the user.\n useEffect(() => {\n if (variant !== 'scroll') return;\n const el = scrollRef.current;\n if (!el || typeof el.scrollTo !== 'function') return;\n if (el.clientWidth > 0 && Math.round(el.scrollLeft / el.clientWidth) === currentPage) return;\n programmaticScroll.current = true;\n el.scrollTo({ left: currentPage * el.clientWidth, behavior: 'smooth' });\n }, [variant, currentPage]);\n\n // Sync a user scroll back into the paging state so bullets and Previous/Next stay accurate.\n function handleScroll(event: React.UIEvent<HTMLDivElement>) {\n onScroll?.(event);\n const { clientWidth, scrollLeft } = event.currentTarget;\n if (clientWidth <= 0) return;\n const page = Math.round(scrollLeft / clientWidth);\n if (programmaticScroll.current) {\n if (page === currentPage) programmaticScroll.current = false;\n return;\n }\n if (page !== currentPage) goToPage(page);\n }\n\n const itemStyle: React.CSSProperties = { flex: `0 0 ${100 / itemsPerPage}%`, boxSizing: 'border-box' };\n\n const renderedItems = items.map((child, index) => (\n <div\n key={index}\n data-fs-carousel-item=\"\"\n style={variant === 'scroll' ? { ...itemStyle, scrollSnapAlign: 'start' } : itemStyle}\n >\n {child}\n </div>\n ));\n\n if (variant === 'scroll') {\n return (\n <div\n {...props}\n ref={mergedScrollRef}\n onScroll={handleScroll}\n data-fs-carousel-track=\"\"\n style={{ display: 'flex', overflowX: 'auto', scrollSnapType: 'x mandatory', ...style }}\n >\n {renderedItems}\n </div>\n );\n }\n\n return (\n <div {...props} ref={ref} data-fs-carousel-track=\"\" style={{ overflow: 'hidden', ...style }}>\n <div\n data-fs-carousel-viewport=\"\"\n style={{ display: 'flex', transform: `translateX(-${currentPage * 100}%)`, transition: 'transform 300ms ease' }}\n >\n {renderedItems}\n </div>\n </div>\n );\n}\n\nexport function CarouselPrevious({ children, onClick, ...props }: CarouselPreviousProps) {\n const { previous, canGoPrevious } = useCarousel();\n return (\n <button\n type=\"button\"\n disabled={!canGoPrevious}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) previous();\n }}\n aria-label=\"Previous\"\n data-fs-carousel-previous=\"\"\n {...props}\n >\n {children}\n </button>\n );\n}\n\nexport function CarouselNext({ children, onClick, ...props }: CarouselNextProps) {\n const { next, canGoNext } = useCarousel();\n return (\n <button\n type=\"button\"\n disabled={!canGoNext}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) next();\n }}\n aria-label=\"Next\"\n data-fs-carousel-next=\"\"\n {...props}\n >\n {children}\n </button>\n );\n}\n\nexport function CarouselBullets({\n ariaLabel = 'Choose page',\n bulletLabel = 'Go to page {page}',\n hideWhenSingle = true,\n ...props\n}: CarouselBulletsProps) {\n const { totalPages, currentPage, goToPage } = useCarousel();\n\n if (hideWhenSingle && totalPages <= 1) return null;\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLButtonElement>, page: number) {\n let target = page;\n switch (event.key) {\n case 'ArrowRight':\n target = Math.min(page + 1, totalPages - 1);\n break;\n case 'ArrowLeft':\n target = Math.max(page - 1, 0);\n break;\n case 'Home':\n target = 0;\n break;\n case 'End':\n target = totalPages - 1;\n break;\n default:\n return;\n }\n event.preventDefault();\n goToPage(target);\n const bullets = event.currentTarget.parentElement?.querySelectorAll<HTMLButtonElement>('[data-fs-carousel-bullet]');\n bullets?.[target]?.focus();\n }\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: a labelled group of pagination buttons is not a <fieldset>\n <div role=\"group\" aria-label={ariaLabel} data-fs-carousel-bullets=\"\" {...props}>\n {Array.from({ length: totalPages }, (_, page) => {\n const isActive = page === currentPage;\n return (\n <button\n key={page}\n type=\"button\"\n aria-label={bulletLabel.replace('{page}', String(page + 1))}\n aria-current={isActive}\n data-fs-carousel-bullet=\"\"\n data-fs-carousel-bullet-selected={String(isActive)}\n onClick={() => goToPage(page)}\n onKeyDown={(event) => handleKeyDown(event, page)}\n />\n );\n })}\n </div>\n );\n}\n\nexport const CarouselRootDefinition = defineComponent<CarouselRootProps>({\n name: 'CarouselRoot',\n importPath: '@vtex/faststore/components',\n component: CarouselRoot,\n editor: { label: 'Carousel Root', category: 'layout' },\n schema: {\n infiniteMode: { type: 'boolean', default: false, label: 'Infinite Mode' },\n variant: { type: ['slide', 'scroll'] as const, default: 'slide', label: 'Variant' },\n itemsPerPage: { type: 'number', default: 1, label: 'Items Per Page' },\n defaultPage: { type: 'number', default: 0, label: 'Default Page' },\n label: { type: 'string', default: 'Carousel', label: 'Aria Label' },\n },\n guideline:\n 'Root of the carousel. Provides paging state to all parts. Compose as: CarouselRoot > (CarouselTrack > [item children] + CarouselPrevious + CarouselNext + CarouselBullets). Set infiniteMode=true to loop seamlessly (arrows never disable); variant=\"scroll\" for native overflow, \"slide\" for transform transitions. itemsPerPage sets how many children are visible per page. Holds no product or media data — nest any children in CarouselTrack.',\n});\n\nexport const CarouselTrackDefinition = defineComponent<CarouselTrackProps>({\n name: 'CarouselTrack',\n importPath: '@vtex/faststore/components',\n component: CarouselTrack,\n editor: { label: 'Carousel Track', category: 'layout' },\n schema: {},\n guideline:\n 'Lays out the carousel items as a single track and reports the child count to CarouselRoot. Wraps each child in an item slot sized to 100/itemsPerPage percent. In slide variant it translates by page; in scroll variant it is the native scroll-snap container. Place the iterated children (e.g. product cards) directly inside. Must be inside CarouselRoot.',\n});\n\nexport const CarouselPreviousDefinition = defineComponent<CarouselPreviousProps>({\n name: 'CarouselPrevious',\n importPath: '@vtex/faststore/components',\n component: CarouselPrevious,\n editor: { label: 'Carousel Previous', category: 'action' },\n schema: {},\n guideline:\n 'Moves the track one page backward. Disabled on the first page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the last page). Accepts any children (Icon, text). Must be inside CarouselRoot.',\n});\n\nexport const CarouselNextDefinition = defineComponent<CarouselNextProps>({\n name: 'CarouselNext',\n importPath: '@vtex/faststore/components',\n component: CarouselNext,\n editor: { label: 'Carousel Next', category: 'action' },\n schema: {},\n guideline:\n 'Moves the track one page forward. Disabled on the last page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the first page). Accepts any children (Icon, text). Must be inside CarouselRoot.',\n});\n\nexport const CarouselBulletsDefinition = defineComponent<CarouselBulletsProps>({\n name: 'CarouselBullets',\n importPath: '@vtex/faststore/components',\n component: CarouselBullets,\n editor: { label: 'Carousel Bullets', category: 'action' },\n schema: {\n ariaLabel: { type: 'string', default: 'Choose page', label: 'Aria Label' },\n bulletLabel: { type: 'string', default: 'Go to page {page}', label: 'Bullet Label Template' },\n hideWhenSingle: { type: 'boolean', default: true, label: 'Hide when single page' },\n },\n guideline:\n 'Renders one bullet button per page and marks the active page. Supports ArrowLeft/ArrowRight/Home/End keyboard navigation. Returns null when there is a single page unless hideWhenSingle={false}. Use {page} in bulletLabel for the 1-based page number. Must be inside CarouselRoot.',\n});\n\nexport const Carousel = {\n Root: CarouselRoot,\n Track: CarouselTrack,\n Previous: CarouselPrevious,\n Next: CarouselNext,\n Bullets: CarouselBullets,\n};\n"],"mappings":";;;;;;AA2DA,MAAM,kBAAkB,cAA2C,IAAI;AAEvE,SAAgB,cAAoC;CAClD,MAAM,MAAM,WAAW,eAAe;CACtC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,uDAAuD;CACjF,OAAO;AACT;AAEA,SAAgB,aAAa,EAC3B,eAAe,OACf,UAAU,SACV,eAAe,GACf,cAAc,GACd,QAAQ,YACR,UACA,GAAG,SACiB;CACpB,MAAM,CAAC,aAAa,kBAAkB,SAAS,WAAW;CAC1D,MAAM,CAAC,WAAW,qBAAqB,SAAS,CAAC;CAEjD,MAAM,UAAU,KAAK,IAAI,GAAG,YAAY;CACxC,MAAM,aAAa,KAAK,IAAI,GAAG,KAAK,KAAK,YAAY,OAAO,CAAC;CAE7D,MAAM,eAAe,aAAa,UAAkB;EAClD,mBAAmB,SAAU,SAAS,QAAQ,OAAO,KAAM;CAC7D,GAAG,CAAC,CAAC;CAGL,gBAAgB;EACd,IAAI,cAAc,GAAG;EACrB,gBAAgB,SAAS,KAAK,IAAI,MAAM,aAAa,CAAC,CAAC;CACzD,GAAG,CAAC,WAAW,UAAU,CAAC;CAE1B,MAAM,WAAW,aACd,SAAiB;EAChB,eAAe,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,aAAa,CAAC,CAAC,CAAC;CAC5D,GACA,CAAC,UAAU,CACb;CAEA,MAAM,OAAO,kBAAkB;EAC7B,gBAAgB,SAAU,gBAAgB,OAAO,KAAK,aAAa,KAAK,IAAI,OAAO,GAAG,aAAa,CAAC,CAAE;CACxG,GAAG,CAAC,cAAc,UAAU,CAAC;CAE7B,MAAM,WAAW,kBAAkB;EACjC,gBAAgB,SAAU,gBAAgB,OAAO,IAAI,cA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AwB;CACnF;CACA,WACE;AACJ,CAAC;AAED,MAAa,WAAW;CACtB,MAAM;CACN,OAAO;CACP,UAAU;CACV,MAAM;CACN,SAAS;AACX"}
1
+ {"version":3,"file":"carousel.js","names":[],"sources":["../../../src/particles/carousel/carousel.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport {\n Children,\n type ComponentPropsWithRef,\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\n\nexport const CarouselRootContent = defineContentType({\n id: 'carousel-root',\n title: 'Carousel Root',\n description: 'Accessible name of the carousel region.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: { type: 'string', title: 'Accessible label', format: 'icu-message', messageSource: 'Carousel' },\n },\n },\n});\n\nexport const CarouselPreviousContent = defineContentType({\n id: 'carousel-previous',\n title: 'Carousel Previous',\n description: 'Accessible name of the previous-page control.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: { type: 'string', title: 'Accessible label', format: 'icu-message', messageSource: 'Previous' },\n },\n },\n});\n\nexport const CarouselNextContent = defineContentType({\n id: 'carousel-next',\n title: 'Carousel Next',\n description: 'Accessible name of the next-page control.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: { type: 'string', title: 'Accessible label', format: 'icu-message', messageSource: 'Next' },\n },\n },\n});\n\nexport const CarouselBulletsContent = defineContentType({\n id: 'carousel-bullets',\n title: 'Carousel Bullets',\n description: 'Accessible names of the page bullets and of their group.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n ariaLabel: {\n type: 'string',\n title: 'Group accessible label',\n format: 'icu-message',\n messageSource: 'Choose page',\n },\n bulletLabel: {\n type: 'string',\n title: 'Bullet accessible label',\n description: 'The page argument is the 1-based page number.',\n format: 'icu-message',\n messageSource: 'Go to page {page}',\n messageArguments: { type: 'object', properties: { page: { type: 'integer' } } },\n messageExample: { page: 2 },\n },\n },\n },\n});\n\nexport type CarouselVariant = 'slide' | 'scroll';\n\nexport type CarouselContextValue = {\n currentPage: number;\n itemCount: number;\n itemsPerPage: number;\n totalPages: number;\n variant: CarouselVariant;\n infiniteMode: boolean;\n goToPage: (page: number) => void;\n next: () => void;\n previous: () => void;\n canGoNext: boolean;\n canGoPrevious: boolean;\n setItemCount: (count: number) => void;\n};\n\nexport type CarouselRootProps = ComponentPropsWithRef<'section'> &\n MessageLocaleProp & {\n infiniteMode?: boolean;\n variant?: CarouselVariant;\n itemsPerPage?: number;\n defaultPage?: number;\n $content?: ContentValue<typeof CarouselRootContent>;\n };\n\nexport type CarouselTrackProps = ComponentPropsWithRef<'div'> & {\n children?: ReactNode;\n};\n\nexport type CarouselPreviousProps = ComponentPropsWithRef<'button'> &\n MessageLocaleProp & {\n children?: ReactNode;\n $content?: ContentValue<typeof CarouselPreviousContent>;\n };\n\nexport type CarouselNextProps = ComponentPropsWithRef<'button'> &\n MessageLocaleProp & {\n children?: ReactNode;\n $content?: ContentValue<typeof CarouselNextContent>;\n };\n\nexport type CarouselBulletsProps = ComponentPropsWithRef<'div'> &\n MessageLocaleProp & {\n hideWhenSingle?: boolean;\n $content?: ContentValue<typeof CarouselBulletsContent>;\n };\n\nconst CarouselContext = createContext<CarouselContextValue | null>(null);\n\nexport function useCarousel(): CarouselContextValue {\n const ctx = useContext(CarouselContext);\n if (!ctx) throw new Error('Carousel components must be used inside CarouselRoot.');\n return ctx;\n}\n\nexport function CarouselRoot({\n infiniteMode = false,\n variant = 'slide',\n itemsPerPage = 1,\n defaultPage = 0,\n $locale,\n $content,\n children,\n ...props\n}: CarouselRootProps) {\n const messages = useMessageFormatter(CarouselRootContent, $content);\n const [currentPage, setCurrentPage] = useState(defaultPage);\n const [itemCount, setItemCountState] = useState(0);\n\n const perPage = Math.max(1, itemsPerPage);\n const totalPages = Math.max(1, Math.ceil(itemCount / perPage));\n\n const setItemCount = useCallback((count: number) => {\n setItemCountState((prev) => (prev === count ? prev : count));\n }, []);\n\n // Keep the current page in range when the number of pages shrinks.\n useEffect(() => {\n if (itemCount === 0) return;\n setCurrentPage((page) => Math.min(page, totalPages - 1));\n }, [itemCount, totalPages]);\n\n const goToPage = useCallback(\n (page: number) => {\n setCurrentPage(Math.max(0, Math.min(page, totalPages - 1)));\n },\n [totalPages],\n );\n\n const next = useCallback(() => {\n setCurrentPage((page) => (infiniteMode ? (page + 1) % totalPages : Math.min(page + 1, totalPages - 1)));\n }, [infiniteMode, totalPages]);\n\n const previous = useCallback(() => {\n setCurrentPage((page) => (infiniteMode ? (page - 1 + totalPages) % totalPages : Math.max(page - 1, 0)));\n }, [infiniteMode, totalPages]);\n\n const canGoNext = infiniteMode ? totalPages > 1 : currentPage < totalPages - 1;\n const canGoPrevious = infiniteMode ? totalPages > 1 : currentPage > 0;\n\n const ctx = useMemo<CarouselContextValue>(\n () => ({\n currentPage,\n itemCount,\n itemsPerPage: perPage,\n totalPages,\n variant,\n infiniteMode,\n goToPage,\n next,\n previous,\n canGoNext,\n canGoPrevious,\n setItemCount,\n }),\n [\n currentPage,\n itemCount,\n perPage,\n totalPages,\n variant,\n infiniteMode,\n goToPage,\n next,\n previous,\n canGoNext,\n canGoPrevious,\n setItemCount,\n ],\n );\n\n return (\n <CarouselContext value={ctx}>\n <section\n {...props}\n data-fs-carousel=\"\"\n data-fs-carousel-variant={variant}\n aria-roledescription=\"carousel\"\n aria-label={messages.format('label')}\n >\n {children}\n </section>\n </CarouselContext>\n );\n}\n\nexport function CarouselTrack({ children, style, ref, onScroll, ...props }: CarouselTrackProps) {\n const { setItemCount, itemsPerPage, currentPage, variant, goToPage } = useCarousel();\n const items = Children.toArray(children);\n const count = items.length;\n const scrollRef = useRef<HTMLDivElement>(null);\n // True while an internal scrollTo animation runs, so the native scroll events it emits do not\n // feed back into goToPage and fight the animation. Cleared once the target page is reached.\n const programmaticScroll = useRef(false);\n\n // Scroll mode needs the internal scrollRef to drive scrollTo, but must still honor a\n // consumer-forwarded ref (the slide branch gets it for free through the element).\n const mergedScrollRef = useCallback(\n (node: HTMLDivElement | null) => {\n scrollRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n\n useEffect(() => {\n setItemCount(count);\n }, [count, setItemCount]);\n\n // In scroll mode the track is the native scroll container; move it to the current page unless it\n // is already there (e.g. the user just scrolled), so a programmatic scroll never fights the user.\n useEffect(() => {\n if (variant !== 'scroll') return;\n const el = scrollRef.current;\n if (!el || typeof el.scrollTo !== 'function') return;\n if (el.clientWidth > 0 && Math.round(el.scrollLeft / el.clientWidth) === currentPage) return;\n programmaticScroll.current = true;\n el.scrollTo({ left: currentPage * el.clientWidth, behavior: 'smooth' });\n }, [variant, currentPage]);\n\n // Sync a user scroll back into the paging state so bullets and Previous/Next stay accurate.\n function handleScroll(event: React.UIEvent<HTMLDivElement>) {\n onScroll?.(event);\n const { clientWidth, scrollLeft } = event.currentTarget;\n if (clientWidth <= 0) return;\n const page = Math.round(scrollLeft / clientWidth);\n if (programmaticScroll.current) {\n if (page === currentPage) programmaticScroll.current = false;\n return;\n }\n if (page !== currentPage) goToPage(page);\n }\n\n const itemStyle: React.CSSProperties = { flex: `0 0 ${100 / itemsPerPage}%`, boxSizing: 'border-box' };\n\n const renderedItems = items.map((child, index) => (\n <div\n key={index}\n data-fs-carousel-item=\"\"\n style={variant === 'scroll' ? { ...itemStyle, scrollSnapAlign: 'start' } : itemStyle}\n >\n {child}\n </div>\n ));\n\n if (variant === 'scroll') {\n return (\n <div\n {...props}\n ref={mergedScrollRef}\n onScroll={handleScroll}\n data-fs-carousel-track=\"\"\n style={{ display: 'flex', overflowX: 'auto', scrollSnapType: 'x mandatory', ...style }}\n >\n {renderedItems}\n </div>\n );\n }\n\n return (\n <div {...props} ref={ref} data-fs-carousel-track=\"\" style={{ overflow: 'hidden', ...style }}>\n <div\n data-fs-carousel-viewport=\"\"\n style={{ display: 'flex', transform: `translateX(-${currentPage * 100}%)`, transition: 'transform 300ms ease' }}\n >\n {renderedItems}\n </div>\n </div>\n );\n}\n\nexport function CarouselPrevious({ $locale, $content, children, onClick, ...props }: CarouselPreviousProps) {\n const { previous, canGoPrevious } = useCarousel();\n const messages = useMessageFormatter(CarouselPreviousContent, $content);\n return (\n <button\n type=\"button\"\n disabled={!canGoPrevious}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) previous();\n }}\n aria-label={messages.format('label')}\n data-fs-carousel-previous=\"\"\n {...props}\n >\n {children}\n </button>\n );\n}\n\nexport function CarouselNext({ $locale, $content, children, onClick, ...props }: CarouselNextProps) {\n const { next, canGoNext } = useCarousel();\n const messages = useMessageFormatter(CarouselNextContent, $content);\n return (\n <button\n type=\"button\"\n disabled={!canGoNext}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) next();\n }}\n aria-label={messages.format('label')}\n data-fs-carousel-next=\"\"\n {...props}\n >\n {children}\n </button>\n );\n}\n\nexport function CarouselBullets({ $locale, $content, hideWhenSingle = true, ...props }: CarouselBulletsProps) {\n const { totalPages, currentPage, goToPage } = useCarousel();\n const messages = useMessageFormatter(CarouselBulletsContent, $content);\n\n if (hideWhenSingle && totalPages <= 1) return null;\n const ariaLabel = messages.format('ariaLabel');\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLButtonElement>, page: number) {\n let target = page;\n switch (event.key) {\n case 'ArrowRight':\n target = Math.min(page + 1, totalPages - 1);\n break;\n case 'ArrowLeft':\n target = Math.max(page - 1, 0);\n break;\n case 'Home':\n target = 0;\n break;\n case 'End':\n target = totalPages - 1;\n break;\n default:\n return;\n }\n event.preventDefault();\n goToPage(target);\n const bullets = event.currentTarget.parentElement?.querySelectorAll<HTMLButtonElement>('[data-fs-carousel-bullet]');\n bullets?.[target]?.focus();\n }\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: a labelled group of pagination buttons is not a <fieldset>\n <div role=\"group\" aria-label={ariaLabel} data-fs-carousel-bullets=\"\" {...props}>\n {Array.from({ length: totalPages }, (_, page) => {\n const isActive = page === currentPage;\n return (\n <button\n key={page}\n type=\"button\"\n aria-label={messages.format('bulletLabel', { page: page + 1 })}\n aria-current={isActive}\n data-fs-carousel-bullet=\"\"\n data-fs-carousel-bullet-selected={String(isActive)}\n onClick={() => goToPage(page)}\n onKeyDown={(event) => handleKeyDown(event, page)}\n />\n );\n })}\n </div>\n );\n}\n\nexport const CarouselRootDefinition = defineComponent<CarouselRootProps>({\n name: 'CarouselRoot',\n importPath: '@vtex/faststore/components',\n component: CarouselRoot,\n content: CarouselRootContent,\n editor: { label: 'Carousel Root', category: 'layout' },\n schema: {\n infiniteMode: { type: 'boolean', default: false, label: 'Infinite Mode' },\n variant: { type: ['slide', 'scroll'] as const, default: 'slide', label: 'Variant' },\n itemsPerPage: { type: 'number', default: 1, label: 'Items Per Page' },\n defaultPage: { type: 'number', default: 0, label: 'Default Page' },\n },\n guideline:\n 'Root of the carousel. Provides paging state to all parts. Compose as: CarouselRoot > (CarouselTrack > [item children] + CarouselPrevious + CarouselNext + CarouselBullets). Set infiniteMode=true to loop seamlessly (arrows never disable); variant=\"scroll\" for native overflow, \"slide\" for transform transitions. itemsPerPage sets how many children are visible per page. Its accessible name comes from the $content field label. Holds no product or media data — nest any children in CarouselTrack.',\n});\n\nexport const CarouselTrackDefinition = defineComponent<CarouselTrackProps>({\n name: 'CarouselTrack',\n importPath: '@vtex/faststore/components',\n component: CarouselTrack,\n editor: { label: 'Carousel Track', category: 'layout' },\n schema: {},\n guideline:\n 'Lays out the carousel items as a single track and reports the child count to CarouselRoot. Wraps each child in an item slot sized to 100/itemsPerPage percent. In slide variant it translates by page; in scroll variant it is the native scroll-snap container. Place the iterated children (e.g. product cards) directly inside. Must be inside CarouselRoot.',\n});\n\nexport const CarouselPreviousDefinition = defineComponent<CarouselPreviousProps>({\n name: 'CarouselPrevious',\n importPath: '@vtex/faststore/components',\n component: CarouselPrevious,\n content: CarouselPreviousContent,\n editor: { label: 'Carousel Previous', category: 'action' },\n schema: {},\n guideline:\n 'Moves the track one page backward. Disabled on the first page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the last page). Accepts any children (Icon, text); its accessible name comes from the $content field label. Must be inside CarouselRoot.',\n});\n\nexport const CarouselNextDefinition = defineComponent<CarouselNextProps>({\n name: 'CarouselNext',\n importPath: '@vtex/faststore/components',\n component: CarouselNext,\n content: CarouselNextContent,\n editor: { label: 'Carousel Next', category: 'action' },\n schema: {},\n guideline:\n 'Moves the track one page forward. Disabled on the last page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the first page). Accepts any children (Icon, text); its accessible name comes from the $content field label. Must be inside CarouselRoot.',\n});\n\nexport const CarouselBulletsDefinition = defineComponent<CarouselBulletsProps>({\n name: 'CarouselBullets',\n importPath: '@vtex/faststore/components',\n component: CarouselBullets,\n content: CarouselBulletsContent,\n editor: { label: 'Carousel Bullets', category: 'action' },\n schema: {\n hideWhenSingle: { type: 'boolean', default: true, label: 'Hide when single page' },\n },\n guideline:\n 'Renders one bullet button per page and marks the active page. Supports ArrowLeft/ArrowRight/Home/End keyboard navigation. Returns null when there is a single page unless hideWhenSingle={false}. The group accessible name is the $content field ariaLabel; each bullet takes bulletLabel, whose page argument is the 1-based page number. Must be inside CarouselRoot.',\n});\n\nexport const Carousel = {\n Root: CarouselRoot,\n Track: CarouselTrack,\n Previous: CarouselPrevious,\n Next: CarouselNext,\n Bullets: CarouselBullets,\n};\n"],"mappings":";;;;;;;;AAiBA,MAAa,sBAAsB,kBAAkB;CACnD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY,EACV,OAAO;GAAE,MAAM;GAAU,OAAO;GAAoB,QAAQ;GAAe,eAAe;EAAW,EACvG;CACF;AACF,CAAC;AAED,MAAa,0BAA0B,kBAAkB;CACvD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MA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ACE;AACJ,CAAC;AAED,MAAa,0BAA0B,gBAAoC;CACzE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAkB,UAAU;CAAS;CACtD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,6BAA6B,gBAAuC;CAC/E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,SAAS;CACT,QAAQ;EAAE,OAAO;EAAqB,UAAU;CAAS;CACzD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,yBAAyB,gBAAmC;CACvE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,SAAS;CACT,QAAQ;EAAE,OAAO;EAAiB,UAAU;CAAS;CACrD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,4BAA4B,gBAAsC;CAC7E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,SAAS;CACT,QAAQ;EAAE,OAAO;EAAoB,UAAU;CAAS;CACxD,QAAQ,EACN,gBAAgB;EAAE,MAAM;EAAW,SAAS;EAAM,OAAO;CAAwB,EACnF;CACA,WACE;AACJ,CAAC;AAED,MAAa,WAAW;CACtB,MAAM;CACN,OAAO;CACP,UAAU;CACV,MAAM;CACN,SAAS;AACX"}
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
  import { defineComponent } from "../../core/dist/define-component.js";
3
3
  import "../../core/dist/index.js";
4
- import { useIntl } from "../../sdk/i18n/client.js";
5
4
  import { Button } from "../button/button.js";
6
5
  import { useEffect, useRef, useState } from "react";
7
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -21,33 +20,24 @@ const CopyTextDefinition = defineComponent({
21
20
  schema: {
22
21
  accessibleName: {
23
22
  type: "string",
24
- default: "Copy",
25
23
  label: "Accessible name"
26
24
  },
27
25
  successMessage: {
28
26
  type: "string",
29
- default: "Copied",
30
27
  label: "Success message"
31
28
  },
32
29
  failureMessage: {
33
30
  type: "string",
34
- default: "Could not copy",
35
31
  label: "Failure message"
36
32
  },
37
33
  dismissLabel: {
38
34
  type: "string",
39
- default: "Dismiss",
40
35
  label: "Dismiss label"
41
36
  }
42
37
  },
43
- guideline: "Copies the text it is given and confirms the result inline. Pass the identifier as text and the visible icon or label as children. Do not pass surrounding heading text."
38
+ guideline: "Copies the text it is given and confirms the result inline. Pass the identifier as text, the visible icon or label as children, and the formatted copy as props; they have no default, so the owner formats every one. Do not pass surrounding heading text."
44
39
  });
45
40
  function CopyText({ text, accessibleName, successMessage, failureMessage, dismissLabel, children, className, ref }) {
46
- const intl = useIntl();
47
- const name = accessibleName ?? intl.formatMessage({ id: "fs/order.copy.action" });
48
- const success = successMessage ?? intl.formatMessage({ id: "fs/order.copy.copied" });
49
- const failure = failureMessage ?? intl.formatMessage({ id: "fs/order.copy.failure" });
50
- const dismissText = dismissLabel ?? intl.formatMessage({ id: "fs/order.copy.dismiss" });
51
41
  const [outcome, setOutcome] = useState("idle");
52
42
  const actionRef = useRef(null);
53
43
  const timerRef = useRef(null);
@@ -107,7 +97,7 @@ function CopyText({ text, accessibleName, successMessage, failureMessage, dismis
107
97
  setOutcome("idle");
108
98
  actionRef.current?.focus();
109
99
  }
110
- const message = outcome === "success" ? success : failure;
100
+ const message = outcome === "success" ? successMessage : failureMessage;
111
101
  return /* @__PURE__ */ jsxs("span", {
112
102
  ref,
113
103
  className,
@@ -116,7 +106,7 @@ function CopyText({ text, accessibleName, successMessage, failureMessage, dismis
116
106
  children: [/* @__PURE__ */ jsx(Button, {
117
107
  ref: actionRef,
118
108
  type: "button",
119
- "aria-label": name,
109
+ "aria-label": accessibleName,
120
110
  "data-fs-copy-text-action": "",
121
111
  disabled: isBlank(text) || outcome === "pending",
122
112
  onClick: () => {
@@ -127,9 +117,9 @@ function CopyText({ text, accessibleName, successMessage, failureMessage, dismis
127
117
  "data-fs-copy-text-message": "",
128
118
  children: [message, /* @__PURE__ */ jsx(Button, {
129
119
  type: "button",
130
- "aria-label": dismissText,
120
+ "aria-label": dismissLabel,
131
121
  onClick: dismiss,
132
- children: dismissText
122
+ children: dismissLabel
133
123
  })]
134
124
  }) : null]
135
125
  });
@@ -1 +1 @@
1
- {"version":3,"file":"copy-text.js","names":[],"sources":["../../../src/particles/copy-text/copy-text.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { type ReactNode, type Ref, useEffect, useRef, useState } from 'react';\nimport { useIntl } from '../../sdk/i18n/client.js';\nimport { Button } from '../button/button';\n\nconst CLEAR_AFTER_MS = 5000;\n\nexport type CopyTextOutcome = 'idle' | 'pending' | 'success' | 'failure';\n\nexport type CopyTextProps = Readonly<{\n text: string;\n accessibleName?: string;\n successMessage?: string;\n failureMessage?: string;\n dismissLabel?: string;\n children?: ReactNode;\n className?: string;\n ref?: Ref<HTMLSpanElement>;\n}>;\n\nfunction isBlank(text: string): boolean {\n return text.trim().length === 0;\n}\n\nexport const CopyTextDefinition = defineComponent<CopyTextProps>({\n name: 'CopyText',\n importPath: '@vtex/faststore/components',\n component: CopyText,\n editor: { label: 'Copy Text', category: 'action' },\n schema: {\n accessibleName: { type: 'string', default: 'Copy', label: 'Accessible name' },\n successMessage: { type: 'string', default: 'Copied', label: 'Success message' },\n failureMessage: { type: 'string', default: 'Could not copy', label: 'Failure message' },\n dismissLabel: { type: 'string', default: 'Dismiss', label: 'Dismiss label' },\n },\n guideline:\n 'Copies the text it is given and confirms the result inline. Pass the identifier as text and the visible icon or label as children. Do not pass surrounding heading text.',\n});\n\nexport function CopyText({\n text,\n accessibleName,\n successMessage,\n failureMessage,\n dismissLabel,\n children,\n className,\n ref,\n}: CopyTextProps) {\n const intl = useIntl();\n const name = accessibleName ?? intl.formatMessage({ id: 'fs/order.copy.action' });\n const success = successMessage ?? intl.formatMessage({ id: 'fs/order.copy.copied' });\n const failure = failureMessage ?? intl.formatMessage({ id: 'fs/order.copy.failure' });\n const dismissText = dismissLabel ?? intl.formatMessage({ id: 'fs/order.copy.dismiss' });\n const [outcome, setOutcome] = useState<CopyTextOutcome>('idle');\n const actionRef = useRef<HTMLButtonElement>(null);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const generation = useRef(0);\n const active = useRef(true);\n\n function clearTimer() {\n if (timerRef.current === null) return;\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n\n useEffect(() => {\n active.current = true;\n return () => {\n active.current = false;\n if (timerRef.current === null) return;\n clearTimeout(timerRef.current);\n timerRef.current = null;\n };\n }, []);\n\n function scheduleClear(token: number) {\n clearTimer();\n if (!active.current) return;\n timerRef.current = setTimeout(() => {\n if (!active.current || generation.current !== token) return;\n setOutcome('idle');\n }, CLEAR_AFTER_MS);\n }\n\n async function copy() {\n if (isBlank(text) || outcome === 'pending') return;\n const token = generation.current + 1;\n generation.current = token;\n clearTimer();\n setOutcome('pending');\n\n const write = navigator.clipboard?.writeText;\n if (typeof write !== 'function') {\n if (!active.current || generation.current !== token) return;\n setOutcome('failure');\n scheduleClear(token);\n return;\n }\n\n try {\n await write.call(navigator.clipboard, text);\n if (!active.current || generation.current !== token) return;\n setOutcome('success');\n } catch {\n if (!active.current || generation.current !== token) return;\n setOutcome('failure');\n }\n scheduleClear(token);\n }\n\n // The action is disabled while pending, and a disabled control ignores focus(). Focus moves back\n // once the outcome that re-enables it has committed.\n useEffect(() => {\n if (outcome === 'success' || outcome === 'failure') {\n actionRef.current?.focus();\n }\n }, [outcome]);\n\n function dismiss() {\n generation.current += 1;\n clearTimer();\n setOutcome('idle');\n actionRef.current?.focus();\n }\n\n const message = outcome === 'success' ? success : failure;\n\n return (\n <span ref={ref} className={className} data-fs-copy-text=\"\" data-fs-copy-text-outcome={outcome}>\n <Button\n ref={actionRef}\n type=\"button\"\n aria-label={name}\n data-fs-copy-text-action=\"\"\n disabled={isBlank(text) || outcome === 'pending'}\n onClick={() => {\n void copy();\n }}\n >\n {children}\n </Button>\n {outcome === 'success' || outcome === 'failure' ? (\n <output data-fs-copy-text-message=\"\">\n {message}\n <Button type=\"button\" aria-label={dismissText} onClick={d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e;IACb,KAAU;GACZ;GAEC;EACK,CAAA,GACP,YAAY,aAAa,YAAY,YACpC,qBAAC,UAAD;GAAQ,6BAA0B;GAAlC,UAAA,CACG,SACD,oBAAC,QAAD;IAAQ,MAAK;IAAS,cAAY;IAAa,SAAS;IACrD,UAAA;GACK,CAAA,CACF;EACN,CAAA,IAAA,IACA;;AAEV"}
1
+ {"version":3,"file":"copy-text.js","names":[],"sources":["../../../src/particles/copy-text/copy-text.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { type ReactNode, type Ref, useEffect, useRef, useState } from 'react';\nimport { Button } from '../button/button';\n\nconst CLEAR_AFTER_MS = 5000;\n\nexport type CopyTextOutcome = 'idle' | 'pending' | 'success' | 'failure';\n\nexport type CopyTextProps = Readonly<{\n text: string;\n accessibleName?: string;\n successMessage?: string;\n failureMessage?: string;\n dismissLabel?: string;\n children?: ReactNode;\n className?: string;\n ref?: Ref<HTMLSpanElement>;\n}>;\n\nfunction isBlank(text: string): boolean {\n return text.trim().length === 0;\n}\n\nexport const CopyTextDefinition = defineComponent<CopyTextProps>({\n name: 'CopyText',\n importPath: '@vtex/faststore/components',\n component: CopyText,\n editor: { label: 'Copy Text', category: 'action' },\n schema: {\n accessibleName: { type: 'string', label: 'Accessible name' },\n successMessage: { type: 'string', label: 'Success message' },\n failureMessage: { type: 'string', label: 'Failure message' },\n dismissLabel: { type: 'string', label: 'Dismiss label' },\n },\n guideline:\n 'Copies the text it is given and confirms the result inline. Pass the identifier as text, the visible icon or label as children, and the formatted copy as props; they have no default, so the owner formats every one. Do not pass surrounding heading text.',\n});\n\nexport function CopyText({\n text,\n accessibleName,\n successMessage,\n failureMessage,\n dismissLabel,\n children,\n className,\n ref,\n}: CopyTextProps) {\n const [outcome, setOutcome] = useState<CopyTextOutcome>('idle');\n const actionRef = useRef<HTMLButtonElement>(null);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const generation = useRef(0);\n const active = useRef(true);\n\n function clearTimer() {\n if (timerRef.current === null) return;\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n\n useEffect(() => {\n active.current = true;\n return () => {\n active.current = false;\n if (timerRef.current === null) return;\n clearTimeout(timerRef.current);\n timerRef.current = null;\n };\n }, []);\n\n function scheduleClear(token: number) {\n clearTimer();\n if (!active.current) return;\n timerRef.current = setTimeout(() => {\n if (!active.current || generation.current !== token) return;\n setOutcome('idle');\n }, CLEAR_AFTER_MS);\n }\n\n async function copy() {\n if (isBlank(text) || outcome === 'pending') return;\n const token = generation.current + 1;\n generation.current = token;\n clearTimer();\n setOutcome('pending');\n\n const write = navigator.clipboard?.writeText;\n if (typeof write !== 'function') {\n if (!active.current || generation.current !== token) return;\n setOutcome('failure');\n scheduleClear(token);\n return;\n }\n\n try {\n await write.call(navigator.clipboard, text);\n if (!active.current || generation.current !== token) return;\n setOutcome('success');\n } catch {\n if (!active.current || generation.current !== token) return;\n setOutcome('failure');\n }\n scheduleClear(token);\n }\n\n // The action is disabled while pending, and a disabled control ignores focus(). Focus moves back\n // once the outcome that re-enables it has committed.\n useEffect(() => {\n if (outcome === 'success' || outcome === 'failure') {\n actionRef.current?.focus();\n }\n }, [outcome]);\n\n function dismiss() {\n generation.current += 1;\n clearTimer();\n setOutcome('idle');\n actionRef.current?.focus();\n }\n\n const message = outcome === 'success' ? successMessage : failureMessage;\n\n return (\n <span ref={ref} className={className} data-fs-copy-text=\"\" data-fs-copy-text-outcome={outcome}>\n <Button\n ref={actionRef}\n type=\"button\"\n aria-label={accessibleName}\n data-fs-copy-text-action=\"\"\n disabled={isBlank(text) || outcome === 'pending'}\n onClick={() => {\n void copy();\n }}\n >\n {children}\n </Button>\n {outcome === 'success' || outcome === 'failure' ? (\n <output data-fs-copy-text-message=\"\">\n {message}\n <Button type=\"button\" aria-label={dismissLabel} onClick={dismiss}>\n {dismissLabel}\n </Button>\n </output>\n ) : null}\n </span>\n );\n}\n"],"mappings":";;;;;;;AAMA,MAAM,iBAAiB;A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