@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.
- package/CHANGELOG.md +101 -0
- package/README.md +0 -1
- package/dist/actions.json +48 -1
- package/dist/catalog.json +1397 -1594
- package/dist/cli/index.d.ts +66 -28
- package/dist/cli/index.js +7371 -512
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/server-runtime.js +41 -60
- package/dist/cli/server-runtime.js.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -2
- package/dist/components.d.ts +67 -56
- package/dist/components.js +64 -53
- package/dist/content-types.json +5886 -555
- package/dist/core/dist/define-component.d.ts +7 -2
- package/dist/core/dist/define-content-type.d.ts +50 -2
- package/dist/core/dist/define-content-type.js +107 -3
- package/dist/core/dist/define-content-type.js.map +1 -1
- package/dist/core/dist/index.d.ts +2 -2
- package/dist/docs/access-code-field.md +1 -1
- package/dist/docs/access-code-sign-in.md +126 -77
- package/dist/docs/account-address-book.md +210 -95
- package/dist/docs/account-entry-point.md +4 -4
- package/dist/docs/account-menu.md +16 -17
- package/dist/docs/account-saved-cards.md +306 -0
- package/dist/docs/alert-dialog.md +3 -1
- package/dist/docs/avatar.md +4 -2
- package/dist/docs/billing-address.md +99 -30
- package/dist/docs/binding-switcher.md +157 -0
- package/dist/docs/buy-button.md +7 -8
- package/dist/docs/card-entry.md +42 -29
- package/dist/docs/card-summary.md +185 -0
- package/dist/docs/cardholder-document.md +5 -3
- package/dist/docs/carousel.md +5 -4
- package/dist/docs/cart-destination.md +251 -0
- package/dist/docs/cart-item.md +48 -15
- package/dist/docs/cart-totalizer.md +8 -6
- package/dist/docs/cart.md +240 -39
- package/dist/docs/challenge-return.md +135 -0
- package/dist/docs/client-preferences-fieldset.md +10 -5
- package/dist/docs/client-preferences.md +31 -8
- package/dist/docs/client-profile-fieldset.md +20 -6
- package/dist/docs/client-profile.md +12 -3
- package/dist/docs/copy-text.md +9 -7
- package/dist/docs/document-field.md +1 -1
- package/dist/docs/email-field.md +2 -1
- package/dist/docs/email-identification.md +12 -2
- package/dist/docs/footer-copyright.md +4 -2
- package/dist/docs/footer-social.md +1 -1
- package/dist/docs/form.md +54 -18
- package/dist/docs/free-shipping-progress.md +18 -13
- package/dist/docs/identity-edit.md +8 -2
- package/dist/docs/identity-summary.md +18 -5
- package/dist/docs/incentives.md +2 -2
- package/dist/docs/installments.md +46 -32
- package/dist/docs/logo.md +1 -1
- package/dist/docs/my-account-profile.md +16 -11
- package/dist/docs/navigation-link.md +5 -3
- package/dist/docs/order-cancel.md +3 -1
- package/dist/docs/order-delivery-address.md +7 -5
- package/dist/docs/order-delivery-group.md +1 -3
- package/dist/docs/order-details-back.md +1 -1
- package/dist/docs/order-details-header.md +1 -4
- package/dist/docs/order-invoice-download.md +60 -0
- package/dist/docs/order-list-row.md +1 -1
- package/dist/docs/order-list-search.md +13 -20
- package/dist/docs/order-list-views.md +11 -17
- package/dist/docs/order-list.md +12 -5
- package/dist/docs/order-payment.md +9 -7
- package/dist/docs/order-placed-date.md +1 -1
- package/dist/docs/order-placed-payment-summary.md +28 -15
- package/dist/docs/order-placed.md +49 -14
- package/dist/docs/order-progress.md +1 -1
- package/dist/docs/order-status-badge.md +20 -9
- package/dist/docs/order-summary.md +2 -2
- package/dist/docs/order-tracking-link.md +58 -0
- package/dist/docs/payment-method-badges.md +32 -6
- package/dist/docs/payment-methods.md +2 -2
- package/dist/docs/payment.md +36 -17
- package/dist/docs/phone-field.md +4 -4
- package/dist/docs/place-order.md +84 -36
- package/dist/docs/postal-code-field.md +3 -1
- package/dist/docs/pricing.md +21 -23
- package/dist/docs/product-gallery.md +19 -20
- package/dist/docs/product-information.md +14 -10
- package/dist/docs/product-list.md +7 -6
- package/dist/docs/product-shelf.md +7 -1
- package/dist/docs/promotion.md +4 -2
- package/dist/docs/region.md +23 -15
- package/dist/docs/save-card.md +7 -6
- package/dist/docs/saved-cards.md +65 -36
- package/dist/docs/select.md +3 -4
- package/dist/docs/shipping-address.md +57 -21
- package/dist/docs/shipping-simulator.md +53 -15
- package/dist/docs/sign-in-disclosure.md +176 -0
- package/dist/docs/sign-in-form.md +78 -47
- package/dist/docs/sign-in-redirect.md +5 -3
- package/dist/docs/sign-in.md +173 -0
- package/dist/docs/toast.md +45 -16
- package/dist/docs/variant-selector.md +15 -11
- package/dist/graphql/types.d.ts +4 -14
- package/dist/index.d.ts +3 -2
- package/dist/internal/client.d.ts +4 -3
- package/dist/internal/client.js +5 -2
- package/dist/internal/server.d.ts +10 -5
- package/dist/internal/server.js +9 -4
- package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
- package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
- package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
- package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
- package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
- package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
- package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
- package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
- package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
- package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
- package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
- package/dist/matter/account-address-book/account-address-book.js +74 -33
- package/dist/matter/account-address-book/account-address-book.js.map +1 -1
- package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
- package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
- package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
- package/dist/matter/account-address-book/account-address-country.js +83 -49
- package/dist/matter/account-address-book/account-address-country.js.map +1 -1
- package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
- package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
- package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
- package/dist/matter/account-address-book/account-address-form.js +518 -155
- package/dist/matter/account-address-book/account-address-form.js.map +1 -1
- package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
- package/dist/matter/account-address-book/account-address-record.js +32 -17
- package/dist/matter/account-address-book/account-address-record.js.map +1 -1
- package/dist/matter/account-menu/account-menu.d.ts +34 -17
- package/dist/matter/account-menu/account-menu.js +46 -54
- package/dist/matter/account-menu/account-menu.js.map +1 -1
- package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
- package/dist/matter/account-saved-cards/account-saved-cards.d.ts +463 -0
- package/dist/matter/account-saved-cards/account-saved-cards.js +1011 -0
- package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -0
- package/dist/matter/billing-address/billing-address.d.ts +156 -74
- package/dist/matter/billing-address/billing-address.js +227 -156
- package/dist/matter/billing-address/billing-address.js.map +1 -1
- package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
- package/dist/matter/breadcrumb/breadcrumb.js +24 -9
- package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/matter/buy-button/buy-button.d.ts +8 -11
- package/dist/matter/buy-button/buy-button.js +10 -19
- package/dist/matter/buy-button/buy-button.js.map +1 -1
- package/dist/matter/card-entry/card-capture.js +12 -4
- package/dist/matter/card-entry/card-capture.js.map +1 -1
- package/dist/matter/card-entry/card-entry.d.ts +123 -32
- package/dist/matter/card-entry/card-entry.js +348 -221
- package/dist/matter/card-entry/card-entry.js.map +1 -1
- package/dist/matter/cart/cart-namespace.d.ts +11 -1
- package/dist/matter/cart/cart-namespace.js +11 -1
- package/dist/matter/cart/cart-namespace.js.map +1 -1
- package/dist/matter/cart/cart.d.ts +416 -45
- package/dist/matter/cart/cart.js +782 -101
- package/dist/matter/cart/cart.js.map +1 -1
- package/dist/matter/cart-destination/cart-destination.d.ts +233 -0
- package/dist/matter/cart-destination/cart-destination.js +703 -0
- package/dist/matter/cart-destination/cart-destination.js.map +1 -0
- package/dist/matter/cart-item/cart-item.d.ts +145 -16
- package/dist/matter/cart-item/cart-item.js +230 -54
- package/dist/matter/cart-item/cart-item.js.map +1 -1
- package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
- package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
- package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
- package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
- package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
- package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
- package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
- package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
- package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
- package/dist/matter/cart-totalizer/cart-totalizer.js +49 -19
- package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
- package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
- package/dist/matter/challenge-return/challenge-return.js +241 -0
- package/dist/matter/challenge-return/challenge-return.js.map +1 -0
- package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
- package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
- package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
- package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
- package/dist/matter/client-preferences/client-preferences.js +84 -15
- package/dist/matter/client-preferences/client-preferences.js.map +1 -1
- package/dist/matter/client-profile/client-profile.d.ts +44 -9
- package/dist/matter/client-profile/client-profile.js +64 -24
- package/dist/matter/client-profile/client-profile.js.map +1 -1
- package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
- package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
- package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
- package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
- package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
- package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
- package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
- package/dist/matter/delivery-options/delivery-options.js +75 -12
- package/dist/matter/delivery-options/delivery-options.js.map +1 -1
- package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
- package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
- package/dist/matter/email-identification/email-identification.d.ts +25 -3
- package/dist/matter/email-identification/email-identification.js +49 -12
- package/dist/matter/email-identification/email-identification.js.map +1 -1
- package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +85 -10
- package/dist/matter/free-shipping-progress/free-shipping-progress.js +153 -53
- package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
- package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
- package/dist/matter/identity-edit/identity-edit.js +47 -19
- package/dist/matter/identity-edit/identity-edit.js.map +1 -1
- package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
- package/dist/matter/identity-summary/identity-summary.js +95 -45
- package/dist/matter/identity-summary/identity-summary.js.map +1 -1
- package/dist/matter/installments/installments-select.d.ts +98 -16
- package/dist/matter/installments/installments-select.js +156 -48
- package/dist/matter/installments/installments-select.js.map +1 -1
- package/dist/matter/installments/installments.d.ts +96 -16
- package/dist/matter/installments/installments.js +115 -40
- package/dist/matter/installments/installments.js.map +1 -1
- package/dist/matter/installments/use-installments-selection.d.ts +1 -0
- package/dist/matter/installments/use-installments-selection.js +8 -3
- package/dist/matter/installments/use-installments-selection.js.map +1 -1
- package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
- package/dist/matter/my-account-profile/my-account-profile.js +370 -174
- package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
- package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
- package/dist/matter/order-cancel/order-cancel.js +118 -51
- package/dist/matter/order-cancel/order-cancel.js.map +1 -1
- package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
- package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
- package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
- package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
- package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
- package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
- package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
- package/dist/matter/order-details-header/order-details-header.js +66 -58
- package/dist/matter/order-details-header/order-details-header.js.map +1 -1
- package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
- package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
- package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
- package/dist/matter/order-list/order-list.d.ts +164 -19
- package/dist/matter/order-list/order-list.js +229 -87
- package/dist/matter/order-list/order-list.js.map +1 -1
- package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
- package/dist/matter/order-list-row/order-list-row.js +3 -2
- package/dist/matter/order-list-row/order-list-row.js.map +1 -1
- package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
- package/dist/matter/order-list-search/order-list-search.js +30 -69
- package/dist/matter/order-list-search/order-list-search.js.map +1 -1
- package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
- package/dist/matter/order-list-views/order-list-views.js +22 -68
- package/dist/matter/order-list-views/order-list-views.js.map +1 -1
- package/dist/matter/order-payment/order-payment.d.ts +33 -10
- package/dist/matter/order-payment/order-payment.js +44 -39
- package/dist/matter/order-payment/order-payment.js.map +1 -1
- package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
- package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
- package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
- package/dist/matter/order-placed/order-placed.d.ts +198 -31
- package/dist/matter/order-placed/order-placed.js +230 -139
- package/dist/matter/order-placed/order-placed.js.map +1 -1
- package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
- package/dist/matter/order-placed-date/order-placed-date.js +7 -8
- package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
- package/dist/matter/order-progress/order-progress.d.ts +19 -8
- package/dist/matter/order-progress/order-progress.js +37 -45
- package/dist/matter/order-progress/order-progress.js.map +1 -1
- package/dist/matter/order-summary/order-summary.d.ts +19 -9
- package/dist/matter/order-summary/order-summary.js +38 -44
- package/dist/matter/order-summary/order-summary.js.map +1 -1
- package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
- package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
- package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
- package/dist/matter/payment/payment-card-capture.js +17 -10
- package/dist/matter/payment/payment-card-capture.js.map +1 -1
- package/dist/matter/payment/payment-controller.d.ts +4 -2
- package/dist/matter/payment/payment-controller.js +30 -9
- package/dist/matter/payment/payment-controller.js.map +1 -1
- package/dist/matter/payment/payment-method-badges.js +1 -1
- package/dist/matter/payment/payment.d.ts +69 -19
- package/dist/matter/payment/payment.js +101 -35
- package/dist/matter/payment/payment.js.map +1 -1
- package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
- package/dist/matter/payment/use-payment-method-selection.js +94 -32
- package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
- package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
- package/dist/matter/payment/use-payment-submit-gate.js +47 -8
- package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
- package/dist/matter/place-order/place-order.d.ts +171 -57
- package/dist/matter/place-order/place-order.js +376 -185
- package/dist/matter/place-order/place-order.js.map +1 -1
- package/dist/matter/pricing/pricing.d.ts +152 -13
- package/dist/matter/pricing/pricing.js +153 -52
- package/dist/matter/pricing/pricing.js.map +1 -1
- package/dist/matter/product-information/product-information.d.ts +27 -4
- package/dist/matter/product-information/product-information.js +32 -15
- package/dist/matter/product-information/product-information.js.map +1 -1
- package/dist/matter/product-list/product-list.d.ts +24 -6
- package/dist/matter/product-list/product-list.js +32 -26
- package/dist/matter/product-list/product-list.js.map +1 -1
- package/dist/matter/product-shelf/product-shelf.d.ts +8 -3
- package/dist/matter/product-shelf/product-shelf.js +111 -10
- package/dist/matter/product-shelf/product-shelf.js.map +1 -1
- package/dist/matter/region/region.d.ts +33 -16
- package/dist/matter/region/region.js +59 -52
- package/dist/matter/region/region.js.map +1 -1
- package/dist/matter/save-card/save-card.d.ts +43 -8
- package/dist/matter/save-card/save-card.js +61 -23
- package/dist/matter/save-card/save-card.js.map +1 -1
- package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
- package/dist/matter/saved-cards/saved-cards.js +349 -77
- package/dist/matter/saved-cards/saved-cards.js.map +1 -1
- package/dist/matter/shipping-address/address-payload.js +25 -0
- package/dist/matter/shipping-address/address-payload.js.map +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +71 -71
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
- package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
- package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
- package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
- package/dist/matter/shipping-address/shipping-address.js +443 -188
- package/dist/matter/shipping-address/shipping-address.js.map +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.d.ts +251 -25
- package/dist/matter/shipping-simulator/shipping-simulator.js +261 -51
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
- package/dist/matter/sign-in/sign-in.d.ts +108 -0
- package/dist/matter/sign-in/sign-in.js +285 -0
- package/dist/matter/sign-in/sign-in.js.map +1 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
- package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
- package/dist/matter/sign-in-form/sign-in-form.js +134 -144
- package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
- package/dist/particles/binding-switcher/binding-switcher.d.ts +59 -0
- package/dist/particles/binding-switcher/binding-switcher.js +194 -0
- package/dist/particles/binding-switcher/binding-switcher.js.map +1 -0
- package/dist/particles/card-summary/card-network.d.ts +17 -0
- package/dist/particles/card-summary/card-network.js +25 -0
- package/dist/particles/card-summary/card-network.js.map +1 -0
- package/dist/particles/card-summary/card-summary.d.ts +113 -0
- package/dist/particles/card-summary/card-summary.js +221 -0
- package/dist/particles/card-summary/card-summary.js.map +1 -0
- package/dist/particles/carousel/carousel.d.ts +99 -11
- package/dist/particles/carousel/carousel.js +103 -35
- package/dist/particles/carousel/carousel.js.map +1 -1
- package/dist/particles/copy-text/copy-text.js +5 -15
- package/dist/particles/copy-text/copy-text.js.map +1 -1
- package/dist/particles/dialog/dialog.d.ts +14 -6
- package/dist/particles/dialog/dialog.js +6 -3
- package/dist/particles/dialog/dialog.js.map +1 -1
- package/dist/particles/drawer/drawer.js +1 -1
- package/dist/particles/drawer/drawer.js.map +1 -1
- package/dist/particles/email-field/email-field.d.ts +2 -1
- package/dist/particles/email-field/email-field.js +2 -1
- package/dist/particles/email-field/email-field.js.map +1 -1
- package/dist/particles/footer-link-group/footer-link-group.js +1 -0
- package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
- package/dist/particles/footer-social/footer-social.d.ts +1 -1
- package/dist/particles/footer-social/footer-social.js +1 -1
- package/dist/particles/footer-social/footer-social.js.map +1 -1
- package/dist/particles/form/form.d.ts +85 -13
- package/dist/particles/form/form.js +91 -42
- package/dist/particles/form/form.js.map +1 -1
- package/dist/particles/gallery/gallery.d.ts +129 -12
- package/dist/particles/gallery/gallery.js +121 -34
- package/dist/particles/gallery/gallery.js.map +1 -1
- package/dist/particles/incentives/incentives.d.ts +1 -1
- package/dist/particles/incentives/incentives.js +1 -1
- package/dist/particles/incentives/incentives.js.map +1 -1
- package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
- package/dist/particles/order-details-back/order-details-back.js +8 -10
- package/dist/particles/order-details-back/order-details-back.js.map +1 -1
- package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
- package/dist/particles/order-status-badge/order-status-badge.js +4 -20
- package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
- package/dist/particles/password-field/password-field.d.ts +1 -1
- package/dist/particles/password-field/password-field.js +2 -4
- package/dist/particles/password-field/password-field.js.map +1 -1
- package/dist/particles/payment-methods/payment-methods.d.ts +1 -1
- package/dist/particles/payment-methods/payment-methods.js +1 -1
- package/dist/particles/payment-methods/payment-methods.js.map +1 -1
- package/dist/particles/phone-field/phone-field.d.ts +4 -4
- package/dist/particles/phone-field/phone-field.js +8 -11
- package/dist/particles/phone-field/phone-field.js.map +1 -1
- package/dist/particles/spinner/spinner.d.ts +24 -4
- package/dist/particles/spinner/spinner.js +25 -9
- package/dist/particles/spinner/spinner.js.map +1 -1
- package/dist/particles/switch/switch.d.ts +4 -1
- package/dist/particles/switch/switch.js +3 -1
- package/dist/particles/switch/switch.js.map +1 -1
- package/dist/particles/toast/toast.d.ts +49 -9
- package/dist/particles/toast/toast.js +81 -15
- package/dist/particles/toast/toast.js.map +1 -1
- package/dist/schema.graphql +461 -89
- package/dist/sdk/actions/index.d.ts +3 -1
- package/dist/sdk/actions/index.js +3 -1
- package/dist/sdk/actions/locale-action-provider.d.ts +16 -0
- package/dist/sdk/actions/locale-action-provider.js +20 -0
- package/dist/sdk/actions/locale-action-provider.js.map +1 -0
- package/dist/sdk/actions/saved-card-action-provider.d.ts +12 -0
- package/dist/sdk/actions/saved-card-action-provider.js +16 -0
- package/dist/sdk/actions/saved-card-action-provider.js.map +1 -0
- package/dist/sdk/actions/types.d.ts +6 -2
- package/dist/sdk/address/address-fields.js +4 -4
- package/dist/sdk/address/address-fields.js.map +1 -1
- package/dist/sdk/address/constants.js +1 -6
- package/dist/sdk/address/constants.js.map +1 -1
- package/dist/sdk/address/messages.js +44 -44
- package/dist/sdk/address/messages.js.map +1 -1
- package/dist/sdk/address/postal-code.js +15 -2
- package/dist/sdk/address/postal-code.js.map +1 -1
- package/dist/sdk/address/types.d.ts +5 -3
- package/dist/sdk/address/validate-address.js +3 -3
- package/dist/sdk/address/validate-address.js.map +1 -1
- package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
- package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
- package/dist/sdk/cache/storefront-cache.js +2 -1
- package/dist/sdk/cache/storefront-cache.js.map +1 -1
- package/dist/sdk/cart/operations.d.ts +2 -1
- package/dist/sdk/cart/operations.js +55 -1
- package/dist/sdk/cart/operations.js.map +1 -1
- package/dist/sdk/cart/optimistic.d.ts +30 -7
- package/dist/sdk/cart/optimistic.js +78 -41
- package/dist/sdk/cart/optimistic.js.map +1 -1
- package/dist/sdk/cart/use-cart-actions.d.ts +7 -0
- package/dist/sdk/cart/use-cart-actions.js +61 -15
- package/dist/sdk/cart/use-cart-actions.js.map +1 -1
- package/dist/sdk/cart/use-cart-sync-sales-channel.js +70 -0
- package/dist/sdk/cart/use-cart-sync-sales-channel.js.map +1 -0
- package/dist/sdk/data/index.js +2 -2
- package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
- package/dist/sdk/generated/gql.js +16 -12
- package/dist/sdk/generated/gql.js.map +1 -1
- package/dist/sdk/generated/graphql.d.ts +197 -51
- package/dist/sdk/generated/graphql.js +2318 -91
- package/dist/sdk/generated/graphql.js.map +1 -1
- package/dist/sdk/i18n/format-error-code.js +23 -0
- package/dist/sdk/i18n/format-error-code.js.map +1 -0
- package/dist/sdk/i18n/message-formatter.d.ts +22 -0
- package/dist/sdk/i18n/message-formatter.js +140 -0
- package/dist/sdk/i18n/message-formatter.js.map +1 -0
- package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
- package/dist/sdk/i18n/use-message-formatter.js +18 -0
- package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
- package/dist/sdk/identity/use-identity-actions.js.map +1 -1
- package/dist/sdk/locale/binding-switch-provider.d.ts +13 -0
- package/dist/sdk/locale/binding-switch-provider.js +20 -0
- package/dist/sdk/locale/binding-switch-provider.js.map +1 -0
- package/dist/sdk/locale/use-locale-actions.d.ts +16 -0
- package/dist/sdk/locale/use-locale-actions.js +70 -0
- package/dist/sdk/locale/use-locale-actions.js.map +1 -0
- package/dist/sdk/navigation/binding-switch.d.ts +39 -0
- package/dist/sdk/navigation/binding-switch.js +129 -0
- package/dist/sdk/navigation/binding-switch.js.map +1 -0
- package/dist/sdk/navigation/decode-route-params.d.ts +11 -0
- package/dist/sdk/navigation/decode-route-params.js +32 -0
- package/dist/sdk/navigation/decode-route-params.js.map +1 -0
- package/dist/sdk/navigation/redirect.d.ts +2 -0
- package/dist/sdk/navigation/redirect.js +19 -1
- package/dist/sdk/navigation/redirect.js.map +1 -1
- package/dist/sdk/navigation/types.d.ts +13 -0
- package/dist/sdk/payment/bin-format.js +20 -0
- package/dist/sdk/payment/bin-format.js.map +1 -0
- package/dist/sdk/payment/challenge-return.js +37 -0
- package/dist/sdk/payment/challenge-return.js.map +1 -0
- package/dist/sdk/payment/confirmation-last-four.js +39 -0
- package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
- package/dist/sdk/payment/gateway.d.ts +1 -1
- package/dist/sdk/payment/gateway.js +8 -2
- package/dist/sdk/payment/gateway.js.map +1 -1
- package/dist/sdk/payment/operations.d.ts +1 -0
- package/dist/sdk/payment/operations.js +28 -6
- package/dist/sdk/payment/operations.js.map +1 -1
- package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
- package/dist/sdk/payment/resumed-purchase.js +119 -0
- package/dist/sdk/payment/resumed-purchase.js.map +1 -0
- package/dist/sdk/payment/security-code-mask.js +16 -23
- package/dist/sdk/payment/security-code-mask.js.map +1 -1
- package/dist/sdk/payment/submission-registry.js +6 -2
- package/dist/sdk/payment/submission-registry.js.map +1 -1
- package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
- package/dist/sdk/payment/use-payment-actions.js +23 -3
- package/dist/sdk/payment/use-payment-actions.js.map +1 -1
- package/dist/sdk/payment/use-place-order.d.ts +10 -2
- package/dist/sdk/payment/use-place-order.js +138 -76
- package/dist/sdk/payment/use-place-order.js.map +1 -1
- package/dist/sdk/provider/storefront-provider.d.ts +1 -7
- package/dist/sdk/provider/storefront-provider.js +4 -11
- package/dist/sdk/provider/storefront-provider.js.map +1 -1
- package/dist/sdk/saved-cards/operations.d.ts +16 -0
- package/dist/sdk/saved-cards/operations.js +41 -0
- package/dist/sdk/saved-cards/operations.js.map +1 -0
- package/dist/sdk/saved-cards/use-saved-card-actions.d.ts +26 -0
- package/dist/sdk/saved-cards/use-saved-card-actions.js +86 -0
- package/dist/sdk/saved-cards/use-saved-card-actions.js.map +1 -0
- package/dist/sdk/seo/entity-landing.d.ts +24 -0
- package/dist/sdk/seo/entity-landing.js +30 -0
- package/dist/sdk/seo/entity-landing.js.map +1 -0
- package/dist/sdk/seo/page-alternates.d.ts +8 -5
- package/dist/sdk/seo/page-alternates.js +11 -14
- package/dist/sdk/seo/page-alternates.js.map +1 -1
- package/dist/sdk/seo/search-landing.d.ts +42 -0
- package/dist/sdk/seo/search-landing.js +85 -0
- package/dist/sdk/seo/search-landing.js.map +1 -0
- package/dist/sdk/session/mock-session.d.ts +9 -0
- package/dist/sdk/session/mock-session.js +31 -0
- package/dist/sdk/session/mock-session.js.map +1 -0
- package/dist/sdk/session/read-server-session.d.ts +3 -0
- package/dist/sdk/session/read-server-session.js +5 -0
- package/dist/sdk/session/read-server-session.js.map +1 -1
- package/dist/sdk/session/return-path-segment.d.ts +10 -0
- package/dist/sdk/session/return-path-segment.js +15 -0
- package/dist/sdk/session/return-path-segment.js.map +1 -0
- package/dist/sdk/session/use-session-actions.js.map +1 -1
- package/dist/sdk/shipping/shipping-operations.d.ts +1 -1
- package/dist/sdk/shipping/shipping-operations.js +13 -0
- package/dist/sdk/shipping/shipping-operations.js.map +1 -1
- package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
- package/dist/sdk/state/cart.d.ts +9 -2
- package/dist/sdk/state/cart.js +9 -2
- package/dist/sdk/state/cart.js.map +1 -1
- package/dist/utils/safe-href.d.ts +2 -0
- package/package.json +4 -3
- package/skills/storefront-asset/SKILL.md +2 -2
- package/skills/storefront-asset/references/api-side.md +27 -14
- package/skills/storefront-asset/references/findings.md +5 -2
- package/src/styles/tailwind.css +9 -2
- package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
- package/dist/message-locales.json +0 -7
- package/dist/sdk/i18n/client.d.ts +0 -4
- package/dist/sdk/i18n/client.js +0 -4
- package/dist/sdk/i18n/locales.d.ts +0 -8
- package/dist/sdk/i18n/locales.js +0 -57
- package/dist/sdk/i18n/locales.js.map +0 -1
- package/dist/sdk/i18n/messages/en-US.js +0 -164
- package/dist/sdk/i18n/messages/en-US.js.map +0 -1
- package/dist/sdk/i18n/messages/en-US.json +0 -159
- package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -163
- package/dist/sdk/i18n/messages/es-ES.js +0 -164
- package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
- package/dist/sdk/i18n/messages/es-ES.json +0 -159
- package/dist/sdk/i18n/messages/pt-BR.js +0 -164
- package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
- package/dist/sdk/i18n/messages/pt-BR.json +0 -159
- package/dist/sdk/i18n/provider.d.ts +0 -1
- package/dist/sdk/i18n/provider.js +0 -30
- package/dist/sdk/i18n/provider.js.map +0 -1
- package/dist/sdk/i18n/server.d.ts +0 -28
- package/dist/sdk/i18n/server.js +0 -59
- package/dist/sdk/i18n/server.js.map +0 -1
- package/dist/utils/resolve-authored-copy.js +0 -18
- package/dist/utils/resolve-authored-copy.js.map +0 -1
- package/dist/utils/substitute-template.js +0 -33
- package/dist/utils/substitute-template.js.map +0 -1
|
@@ -1,10 +1,13 @@
|
|
|
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
|
-
import { Toast, ToastManager, ToastManager as ToastManager$1, ToastRootToastObject } from "@base-ui/react/toast";
|
|
5
|
+
import { Toast, ToastManager, ToastManager as ToastManager$1, ToastRootToastObject, UseToastManagerReturnValue } from "@base-ui/react/toast";
|
|
5
6
|
//#region src/particles/toast/toast.d.ts
|
|
6
7
|
/** The queued toast object `useToast().toasts` returns and `ToastRoot` renders. */
|
|
7
8
|
export type ToastObject = ToastRootToastObject;
|
|
9
|
+
/** What `useOptionalToast` returns under a provider; same shape as `useToast()`. */
|
|
10
|
+
export type ToastManagerValue = UseToastManagerReturnValue;
|
|
8
11
|
type SwipeDirection = 'up' | 'down' | 'left' | 'right';
|
|
9
12
|
export type ToastProviderProps = Readonly<{
|
|
10
13
|
/** Max concurrent toasts before older ones are marked limited. */
|
|
@@ -19,15 +22,21 @@ export type ToastPortalProps = Readonly<{
|
|
|
19
22
|
className?: string;
|
|
20
23
|
children?: ReactNode;
|
|
21
24
|
}>;
|
|
22
|
-
export type ToastViewportProps = ComponentPropsWithRef<'div'
|
|
25
|
+
export type ToastViewportProps = Omit<ComponentPropsWithRef<'div'>, 'aria-label'> & MessageLocaleProp & {
|
|
26
|
+
$content?: ContentValue<typeof ToastViewportContent>;
|
|
27
|
+
};
|
|
23
28
|
export type ToastRootProps = Readonly<{
|
|
24
|
-
/** The queued toast to render
|
|
25
|
-
toast
|
|
29
|
+
/** The queued toast to render. Defaults to the toast `ToastList` publishes. */
|
|
30
|
+
toast?: ToastObject;
|
|
26
31
|
/** Directions the toast can be swiped to dismiss. @default ['down', 'right'] */
|
|
27
32
|
swipeDirection?: SwipeDirection | SwipeDirection[];
|
|
28
33
|
className?: string;
|
|
29
34
|
children?: ReactNode;
|
|
30
35
|
}>;
|
|
36
|
+
export type ToastListProps = Readonly<{
|
|
37
|
+
/** The per-toast template, rendered once per queued toast. */
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
}>;
|
|
31
40
|
export type ToastTitleProps = ComponentPropsWithRef<'h2'>;
|
|
32
41
|
export type ToastDescriptionProps = ComponentPropsWithRef<'p'>;
|
|
33
42
|
export type ToastActionProps = ComponentPropsWithRef<'button'>;
|
|
@@ -45,23 +54,53 @@ export declare const ToastPortalDefinition: ComponentDefinition<Readonly<{
|
|
|
45
54
|
className?: string;
|
|
46
55
|
children?: ReactNode;
|
|
47
56
|
}>>;
|
|
48
|
-
export declare const
|
|
57
|
+
export declare const ToastViewportContent: {
|
|
58
|
+
readonly id: "toast-viewport";
|
|
59
|
+
readonly title: "Toast Viewport";
|
|
60
|
+
readonly description: "Accessible names of the toast region and of each toast's close button.";
|
|
61
|
+
readonly schema: {
|
|
62
|
+
readonly type: "object";
|
|
63
|
+
readonly additionalProperties: false;
|
|
64
|
+
readonly properties: {
|
|
65
|
+
readonly regionLabel: {
|
|
66
|
+
readonly type: "string";
|
|
67
|
+
readonly title: "Region name";
|
|
68
|
+
readonly format: "icu-message";
|
|
69
|
+
readonly messageSource: "Notifications";
|
|
70
|
+
};
|
|
71
|
+
readonly dismissLabel: {
|
|
72
|
+
readonly type: "string";
|
|
73
|
+
readonly title: "Close button name";
|
|
74
|
+
readonly format: "icu-message";
|
|
75
|
+
readonly messageSource: "Dismiss";
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export declare const ToastViewportDefinition: ComponentDefinition<ToastViewportProps>;
|
|
49
81
|
export declare const ToastRootDefinition: ComponentDefinition<Readonly<{
|
|
50
|
-
/** The queued toast to render
|
|
51
|
-
toast
|
|
82
|
+
/** The queued toast to render. Defaults to the toast `ToastList` publishes. */
|
|
83
|
+
toast?: ToastObject;
|
|
52
84
|
/** Directions the toast can be swiped to dismiss. @default ['down', 'right'] */
|
|
53
85
|
swipeDirection?: SwipeDirection | SwipeDirection[];
|
|
54
86
|
className?: string;
|
|
55
87
|
children?: ReactNode;
|
|
56
88
|
}>>;
|
|
89
|
+
export declare const ToastListDefinition: ComponentDefinition<Readonly<{
|
|
90
|
+
/** The per-toast template, rendered once per queued toast. */
|
|
91
|
+
children?: ReactNode;
|
|
92
|
+
}>>;
|
|
57
93
|
export declare const ToastTitleDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
58
94
|
export declare const ToastDescriptionDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>>;
|
|
59
95
|
export declare const ToastActionDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
|
|
60
96
|
export declare const ToastCloseDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
|
|
61
97
|
export declare function ToastProvider({ limit, timeout, toastManager, children }: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
98
|
+
/** The toast manager under a `ToastProvider`, or `null` without one. Never throws. */
|
|
99
|
+
export declare function useOptionalToast(): ToastManagerValue | null;
|
|
100
|
+
export declare function ToastList({ children }: ToastListProps): import("react/jsx-runtime").JSX.Element | null;
|
|
62
101
|
export declare function ToastPortal({ className, children }: ToastPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
63
|
-
export declare function ToastViewport({
|
|
64
|
-
export declare function ToastRoot({ toast, swipeDirection, className, children }: ToastRootProps): import("react/jsx-runtime").JSX.Element;
|
|
102
|
+
export declare function ToastViewport({ $content, $locale, className, children, ...props }: ToastViewportProps): import("react/jsx-runtime").JSX.Element;
|
|
103
|
+
export declare function ToastRoot({ toast: toastProp, swipeDirection, className, children }: ToastRootProps): import("react/jsx-runtime").JSX.Element | null;
|
|
65
104
|
export declare function ToastTitle({ className, children, ...props }: ToastTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
66
105
|
export declare function ToastDescription({ className, children, ...props }: ToastDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
67
106
|
export declare function ToastAction({ className, children, ...props }: ToastActionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -72,6 +111,7 @@ declare const Toast$1: {
|
|
|
72
111
|
Provider: typeof ToastProvider;
|
|
73
112
|
Portal: typeof ToastPortal;
|
|
74
113
|
Viewport: typeof ToastViewport;
|
|
114
|
+
List: typeof ToastList;
|
|
75
115
|
Root: typeof ToastRoot;
|
|
76
116
|
Title: typeof ToastTitle;
|
|
77
117
|
Description: typeof ToastDescription;
|
|
@@ -1,11 +1,16 @@
|
|
|
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";
|
|
4
|
-
import {
|
|
5
|
-
import { Children } from "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
|
|
6
|
+
import { Children, createContext, useContext } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { Toast } from "@base-ui/react/toast";
|
|
8
9
|
//#region src/particles/toast/toast.tsx
|
|
10
|
+
/** Set by `ToastProvider`; `null` outside one. */
|
|
11
|
+
const ToastManagerContext = createContext(null);
|
|
12
|
+
/** Set by `ToastList` for each queued toast; read by `ToastRoot` when its `toast` prop is absent. */
|
|
13
|
+
const ToastItemContext = createContext(null);
|
|
9
14
|
const ToastProviderDefinition = defineComponent({
|
|
10
15
|
name: "ToastProvider",
|
|
11
16
|
importPath: "@vtex/faststore/components",
|
|
@@ -26,7 +31,8 @@ const ToastProviderDefinition = defineComponent({
|
|
|
26
31
|
label: "Default Auto-Dismiss (ms)"
|
|
27
32
|
}
|
|
28
33
|
},
|
|
29
|
-
|
|
34
|
+
providesContext: "toast",
|
|
35
|
+
guideline: "Mount once at the layout root, above the Slot. Compose as: ToastProvider > ToastPortal > ToastViewport. A childless ToastViewport renders the active toasts itself; to control the markup, put a ToastList with a ToastRoot template inside it. Code raises toasts with useOptionalToast() (null without a provider) or useToast() (throws without one)."
|
|
30
36
|
});
|
|
31
37
|
const ToastPortalDefinition = defineComponent({
|
|
32
38
|
name: "ToastPortal",
|
|
@@ -39,16 +45,40 @@ const ToastPortalDefinition = defineComponent({
|
|
|
39
45
|
schema: {},
|
|
40
46
|
guideline: "Renders its children (ToastViewport) outside the DOM tree, into document.body. Direct child of ToastProvider."
|
|
41
47
|
});
|
|
48
|
+
const ToastViewportContent = defineContentType({
|
|
49
|
+
id: "toast-viewport",
|
|
50
|
+
title: "Toast Viewport",
|
|
51
|
+
description: "Accessible names of the toast region and of each toast's close button.",
|
|
52
|
+
schema: {
|
|
53
|
+
type: "object",
|
|
54
|
+
additionalProperties: false,
|
|
55
|
+
properties: {
|
|
56
|
+
regionLabel: {
|
|
57
|
+
type: "string",
|
|
58
|
+
title: "Region name",
|
|
59
|
+
format: "icu-message",
|
|
60
|
+
messageSource: "Notifications"
|
|
61
|
+
},
|
|
62
|
+
dismissLabel: {
|
|
63
|
+
type: "string",
|
|
64
|
+
title: "Close button name",
|
|
65
|
+
format: "icu-message",
|
|
66
|
+
messageSource: "Dismiss"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
42
71
|
const ToastViewportDefinition = defineComponent({
|
|
43
72
|
name: "ToastViewport",
|
|
44
73
|
importPath: "@vtex/faststore/components",
|
|
45
74
|
component: ToastViewport,
|
|
75
|
+
content: ToastViewportContent,
|
|
46
76
|
editor: {
|
|
47
77
|
label: "Toast Viewport",
|
|
48
78
|
category: "layout"
|
|
49
79
|
},
|
|
50
80
|
schema: {},
|
|
51
|
-
guideline: "The fixed-position stack container for all active toasts. With no children it renders every active toast itself (title, description, action and a
|
|
81
|
+
guideline: "The fixed-position stack container for all active toasts. With no children it renders every active toast itself (title, description, action and a close button named by its dismissLabel message), so a page schema needs only ToastProvider > ToastPortal > ToastViewport. Pass children to take control of the markup: a ToastList with a ToastRoot template is the schema-composable way (it renders the template once per queued toast), or map useToast().toasts to ToastRoot in code. Position it with a swatch on data-fs-toast-viewport (e.g. bottom-right vs. top-center). Direct child of ToastPortal."
|
|
52
82
|
});
|
|
53
83
|
const ToastRootDefinition = defineComponent({
|
|
54
84
|
name: "ToastRoot",
|
|
@@ -59,7 +89,21 @@ const ToastRootDefinition = defineComponent({
|
|
|
59
89
|
category: "layout"
|
|
60
90
|
},
|
|
61
91
|
schema: {},
|
|
62
|
-
|
|
92
|
+
requiresContext: "toast-item",
|
|
93
|
+
guideline: "One instance per active toast. Inside a ToastList it is the per-toast template and reads its toast from the list; a childless ToastViewport renders its own ToastRoot per toast, so compose one only to override that. Compose as: ToastRoot > (Icon + ToastTitle + ToastDescription + ToastAction + ToastClose), all optional except at least one of Title/Description."
|
|
94
|
+
});
|
|
95
|
+
const ToastListDefinition = defineComponent({
|
|
96
|
+
name: "ToastList",
|
|
97
|
+
importPath: "@vtex/faststore/components",
|
|
98
|
+
component: ToastList,
|
|
99
|
+
editor: {
|
|
100
|
+
label: "Toast List",
|
|
101
|
+
category: "layout"
|
|
102
|
+
},
|
|
103
|
+
schema: {},
|
|
104
|
+
requiresContext: "toast",
|
|
105
|
+
providesContext: "toast-item",
|
|
106
|
+
guideline: "Renders its children once per queued toast; place a ToastRoot (with ToastTitle and ToastDescription, both auto-filled from the toast) inside it as the template. With no children it renders that template by default. Direct child of ToastViewport; renders nothing without a ToastProvider ancestor."
|
|
63
107
|
});
|
|
64
108
|
const ToastTitleDefinition = defineComponent({
|
|
65
109
|
name: "ToastTitle",
|
|
@@ -110,9 +154,28 @@ function ToastProvider({ limit = 3, timeout = 5e3, toastManager, children }) {
|
|
|
110
154
|
limit,
|
|
111
155
|
timeout,
|
|
112
156
|
toastManager,
|
|
157
|
+
children: /* @__PURE__ */ jsx(ToastManagerBridge, { children })
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function ToastManagerBridge({ children }) {
|
|
161
|
+
const manager = Toast.useToastManager();
|
|
162
|
+
return /* @__PURE__ */ jsx(ToastManagerContext.Provider, {
|
|
163
|
+
value: manager,
|
|
113
164
|
children
|
|
114
165
|
});
|
|
115
166
|
}
|
|
167
|
+
/** The toast manager under a `ToastProvider`, or `null` without one. Never throws. */
|
|
168
|
+
function useOptionalToast() {
|
|
169
|
+
return useContext(ToastManagerContext);
|
|
170
|
+
}
|
|
171
|
+
function ToastList({ children }) {
|
|
172
|
+
const manager = useOptionalToast();
|
|
173
|
+
if (!manager) return null;
|
|
174
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: manager.toasts.map((toast) => /* @__PURE__ */ jsx(ToastItemContext.Provider, {
|
|
175
|
+
value: toast,
|
|
176
|
+
children: children ?? /* @__PURE__ */ jsxs(ToastRoot, { children: [/* @__PURE__ */ jsx(ToastTitle, {}), /* @__PURE__ */ jsx(ToastDescription, {})] })
|
|
177
|
+
}, toast.id)) });
|
|
178
|
+
}
|
|
116
179
|
function ToastPortal({ className, children }) {
|
|
117
180
|
return /* @__PURE__ */ jsx(Toast.Portal, {
|
|
118
181
|
className,
|
|
@@ -122,8 +185,7 @@ function ToastPortal({ className, children }) {
|
|
|
122
185
|
function hasChildren(children) {
|
|
123
186
|
return Children.toArray(children).length > 0;
|
|
124
187
|
}
|
|
125
|
-
function DefaultToastList() {
|
|
126
|
-
const intl = useIntl();
|
|
188
|
+
function DefaultToastList({ dismissLabel }) {
|
|
127
189
|
const { toasts } = useToast();
|
|
128
190
|
return toasts.map((toast) => /* @__PURE__ */ jsxs(ToastRoot, {
|
|
129
191
|
toast,
|
|
@@ -132,7 +194,7 @@ function DefaultToastList() {
|
|
|
132
194
|
/* @__PURE__ */ jsx(ToastDescription, {}),
|
|
133
195
|
/* @__PURE__ */ jsx(ToastAction, {}),
|
|
134
196
|
/* @__PURE__ */ jsx(ToastClose, {
|
|
135
|
-
"aria-label":
|
|
197
|
+
"aria-label": dismissLabel,
|
|
136
198
|
children: /* @__PURE__ */ jsx("span", {
|
|
137
199
|
"aria-hidden": "true",
|
|
138
200
|
children: "×"
|
|
@@ -141,21 +203,24 @@ function DefaultToastList() {
|
|
|
141
203
|
]
|
|
142
204
|
}, toast.id));
|
|
143
205
|
}
|
|
144
|
-
function ToastViewport({
|
|
145
|
-
const
|
|
206
|
+
function ToastViewport({ $content, $locale, className, children, ...props }) {
|
|
207
|
+
const { format } = useMessageFormatter(ToastViewportContent, $content);
|
|
146
208
|
return /* @__PURE__ */ jsx(Toast.Viewport, {
|
|
147
209
|
...props,
|
|
148
|
-
"aria-label":
|
|
210
|
+
"aria-label": format("regionLabel"),
|
|
149
211
|
className,
|
|
150
212
|
render: (renderProps, state) => /* @__PURE__ */ jsx("div", {
|
|
151
213
|
...renderProps,
|
|
152
214
|
"data-fs-toast-viewport": "",
|
|
153
215
|
"data-fs-toast-viewport-expanded": state.expanded ? "" : void 0,
|
|
154
|
-
children: hasChildren(children) ? children : /* @__PURE__ */ jsx(DefaultToastList, {})
|
|
216
|
+
children: hasChildren(children) ? children : /* @__PURE__ */ jsx(DefaultToastList, { dismissLabel: format("dismissLabel") })
|
|
155
217
|
})
|
|
156
218
|
});
|
|
157
219
|
}
|
|
158
|
-
function ToastRoot({ toast, swipeDirection, className, children }) {
|
|
220
|
+
function ToastRoot({ toast: toastProp, swipeDirection, className, children }) {
|
|
221
|
+
const itemToast = useContext(ToastItemContext);
|
|
222
|
+
const toast = toastProp ?? itemToast;
|
|
223
|
+
if (!toast) return null;
|
|
159
224
|
return /* @__PURE__ */ jsx(Toast.Root, {
|
|
160
225
|
toast,
|
|
161
226
|
swipeDirection,
|
|
@@ -208,6 +273,7 @@ const Toast$1 = {
|
|
|
208
273
|
Provider: ToastProvider,
|
|
209
274
|
Portal: ToastPortal,
|
|
210
275
|
Viewport: ToastViewport,
|
|
276
|
+
List: ToastList,
|
|
211
277
|
Root: ToastRoot,
|
|
212
278
|
Title: ToastTitle,
|
|
213
279
|
Description: ToastDescription,
|
|
@@ -215,6 +281,6 @@ const Toast$1 = {
|
|
|
215
281
|
Close: ToastClose
|
|
216
282
|
};
|
|
217
283
|
//#endregion
|
|
218
|
-
export { Toast$1 as Toast, ToastAction, ToastActionDefinition, ToastClose, ToastCloseDefinition, ToastDescription, ToastDescriptionDefinition, ToastPortal, ToastPortalDefinition, ToastProvider, ToastProviderDefinition, ToastRoot, ToastRootDefinition, ToastTitle, ToastTitleDefinition, ToastViewport, ToastViewportDefinition, useToast };
|
|
284
|
+
export { Toast$1 as Toast, ToastAction, ToastActionDefinition, ToastClose, ToastCloseDefinition, ToastDescription, ToastDescriptionDefinition, ToastList, ToastListDefinition, ToastPortal, ToastPortalDefinition, ToastProvider, ToastProviderDefinition, ToastRoot, ToastRootDefinition, ToastTitle, ToastTitleDefinition, ToastViewport, ToastViewportContent, ToastViewportDefinition, useOptionalToast, useToast };
|
|
219
285
|
|
|
220
286
|
//# sourceMappingURL=toast.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","names":["BaseToast","Toast"],"sources":["../../../src/particles/toast/toast.tsx"],"sourcesContent":["'use client';\nimport type { ToastManager, ToastRootToastObject } from '@base-ui/react/toast';\nimport { Toast as BaseToast } from '@base-ui/react/toast';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\nimport { Children } from 'react';\nimport { useIntl } from '../../sdk/i18n/client.js';\n\n/** The queued toast object `useToast().toasts` returns and `ToastRoot` renders. */\nexport type ToastObject = ToastRootToastObject;\nexport type { ToastManager } from '@base-ui/react/toast';\n\ntype SwipeDirection = 'up' | 'down' | 'left' | 'right';\n\nexport type ToastProviderProps = Readonly<{\n /** Max concurrent toasts before older ones are marked limited. */\n limit?: number;\n /** Default auto-dismiss delay (ms); `0` disables. */\n timeout?: number;\n /** External manager for triggering toasts outside React (e.g. a non-component module). */\n toastManager?: ToastManager;\n children?: ReactNode;\n}>;\n\nexport type ToastPortalProps = Readonly<{\n className?: string;\n children?: ReactNode;\n}>;\n\nexport type ToastViewportProps = ComponentPropsWithRef<'div'>;\n\nexport type ToastRootProps = Readonly<{\n /** The queued toast to render, from `useToast().toasts`. */\n toast: ToastObject;\n /** Directions the toast can be swiped to dismiss. @default ['down', 'right'] */\n swipeDirection?: SwipeDirection | SwipeDirection[];\n className?: string;\n children?: ReactNode;\n}>;\n\nexport type ToastTitleProps = ComponentPropsWithRef<'h2'>;\n\nexport type ToastDescriptionProps = ComponentPropsWithRef<'p'>;\n\nexport type ToastActionProps = ComponentPropsWithRef<'button'>;\n\nexport type ToastCloseProps = ComponentPropsWithRef<'button'>;\n\nexport const ToastProviderDefinition = defineComponent<ToastProviderProps>({\n name: 'ToastProvider',\n importPath: '@vtex/faststore/components',\n component: ToastProvider,\n editor: { label: 'Toast Provider', category: 'layout' },\n schema: {\n limit: { type: 'number', default: 3, label: 'Max Concurrent Toasts' },\n timeout: { type: 'number', default: 5000, label: 'Default Auto-Dismiss (ms)' },\n },\n guideline:\n 'Mount once at the layout root to enable toasts anywhere in the tree. Compose as: ToastProvider > ToastPortal > ToastViewport (a childless viewport renders the active toasts itself; add ToastRoot children only to override). Components trigger toasts via the useToast() hook, not through page-schema composition.',\n});\n\nexport const ToastPortalDefinition = defineComponent<ToastPortalProps>({\n name: 'ToastPortal',\n importPath: '@vtex/faststore/components',\n component: ToastPortal,\n editor: { label: 'Toast Portal', category: 'layout' },\n schema: {},\n guideline:\n 'Renders its children (ToastViewport) outside the DOM tree, into document.body. Direct child of ToastProvider.',\n});\n\nexport const ToastViewportDefinition = defineComponent<ToastViewportProps>({\n name: 'ToastViewport',\n importPath: '@vtex/faststore/components',\n component: ToastViewport,\n editor: { label: 'Toast Viewport', category: 'layout' },\n schema: {},\n guideline:\n 'The fixed-position stack container for all active toasts. With no children it renders every active toast itself (title, description, action and a localized close button), so a page schema needs only ToastProvider > ToastPortal > ToastViewport. Pass children (a ToastRoot per useToast().toasts entry) to take control of the markup. Position it with a swatch on data-fs-toast-viewport (e.g. bottom-right vs. top-center). Direct child of ToastPortal.',\n});\n\nexport const ToastRootDefinition = defineComponent<ToastRootProps>({\n name: 'ToastRoot',\n importPath: '@vtex/faststore/components',\n component: ToastRoot,\n editor: { label: 'Toast Root', category: 'layout' },\n schema: {},\n guideline:\n 'One instance per active toast. A childless ToastViewport renders these itself; compose ToastRoot only to override that, by mapping over useToast().toasts. Compose as: ToastRoot > (Icon + ToastTitle + ToastDescription + ToastAction + ToastClose), all optional except at least one of Title/Description.',\n});\n\nexport const ToastTitleDefinition = defineComponent<ToastTitleProps>({\n name: 'ToastTitle',\n importPath: '@vtex/faststore/components',\n component: ToastTitle,\n editor: { label: 'Toast Title', category: 'layout' },\n schema: {},\n guideline: 'Renders the toast.title automatically when composed with no children. Direct child of ToastRoot.',\n});\n\nexport const ToastDescriptionDefinition = defineComponent<ToastDescriptionProps>({\n name: 'ToastDescription',\n importPath: '@vtex/faststore/components',\n component: ToastDescription,\n editor: { label: 'Toast Description', category: 'layout' },\n schema: {},\n guideline:\n 'Renders the toast.description automatically when composed with no children. Direct child of ToastRoot, after ToastTitle.',\n});\n\nexport const ToastActionDefinition = defineComponent<ToastActionProps>({\n name: 'ToastAction',\n importPath: '@vtex/faststore/components',\n component: ToastAction,\n editor: { label: 'Toast Action', category: 'action' },\n schema: {},\n guideline: \"Reversible-action button (e.g. Undo) forwarding the toast's actionProps. Omit for toasts with no action.\",\n});\n\nexport const ToastCloseDefinition = defineComponent<ToastCloseProps>({\n name: 'ToastClose',\n importPath: '@vtex/faststore/components',\n component: ToastClose,\n editor: { label: 'Toast Close', category: 'action' },\n schema: {},\n guideline: 'Dismisses the nearest ancestor ToastRoot when clicked. Can appear alongside or instead of ToastAction.',\n});\n\nexport function ToastProvider({ limit = 3, timeout = 5000, toastManager, children }: ToastProviderProps) {\n return (\n <BaseToast.Provider limit={limit} timeout={timeout} toastManager={toastManager}>\n {children}\n </BaseToast.Provider>\n );\n}\n\nexport function ToastPortal({ className, children }: ToastPortalProps) {\n return <BaseToast.Portal className={className}>{children}</BaseToast.Portal>;\n}\n\nfunction hasChildren(children: ReactNode): boolean {\n return Children.toArray(children).length > 0;\n}\n\nfunction DefaultToastList() {\n const intl = useIntl();\n const { toasts } = useToast();\n\n return toasts.map((toast) => (\n <ToastRoot key={toast.id} toast={toast}>\n <ToastTitle />\n <ToastDescription />\n <ToastAction />\n <ToastClose aria-label={intl.formatMessage({ id: 'fs/toast.dismiss' })}>\n <span aria-hidden=\"true\">×</span>\n </ToastClose>\n </ToastRoot>\n ));\n}\n\nexport function ToastViewport({ className, children, 'aria-label': ariaLabel, ...props }: ToastViewportProps) {\n const intl = useIntl();\n\n return (\n <BaseToast.Viewport\n {...props}\n aria-label={ariaLabel ?? intl.formatMessage({ id: 'fs/toast.region' })}\n className={className}\n render={(renderProps, state) => (\n <div\n {...renderProps}\n data-fs-toast-viewport=\"\"\n data-fs-toast-viewport-expanded={state.expanded ? '' : undefined}\n >\n {hasChildren(children) ? children : <DefaultToastList />}\n </div>\n )}\n />\n );\n}\n\n// Uses Base UI's `render` prop (rather than plain prop-forwarding, unlike the rest of this file) so\n// `data-fs-toast-root-type`/`-limited`/`-swiping` can mirror internal render state (`state.type`,\n// `state.limited`, `state.swiping`) that is never exposed back to us as a prop.\nexport function ToastRoot({ toast, swipeDirection, className, children }: ToastRootProps) {\n return (\n <BaseToast.Root\n toast={toast}\n swipeDirection={swipeDirection}\n className={className}\n render={(renderProps, state) => (\n <div\n {...renderProps}\n data-fs-toast-root=\"\"\n data-fs-toast-root-type={state.type}\n data-fs-toast-root-limited={state.limited ? '' : undefined}\n data-fs-toast-root-swiping={state.swiping ? '' : undefined}\n >\n {children}\n </div>\n )}\n />\n );\n}\n\nexport function ToastTitle({ className, children, ...props }: ToastTitleProps) {\n return (\n <BaseToast.Title {...props} className={className} data-fs-toast-title=\"\">\n {children}\n </BaseToast.Title>\n );\n}\n\nexport function ToastDescription({ className, children, ...props }: ToastDescriptionProps) {\n return (\n <BaseToast.Description {...props} className={className} data-fs-toast-description=\"\">\n {children}\n </BaseToast.Description>\n );\n}\n\nexport function ToastAction({ className, children, ...props }: ToastActionProps) {\n return (\n <BaseToast.Action {...props} className={className} data-fs-toast-action=\"\">\n {children}\n </BaseToast.Action>\n );\n}\n\nexport function ToastClose({ className, children, ...props }: ToastCloseProps) {\n return (\n <BaseToast.Close {...props} className={className} data-fs-toast-close=\"\">\n {children}\n </BaseToast.Close>\n );\n}\n\n/** Thin re-export of Base UI's `useToastManager()` — see Key Decision 1 in the spec. */\nexport const useToast = BaseToast.useToastManager;\n\nexport const Toast = {\n Provider: ToastProvider,\n Portal: ToastPortal,\n Viewport: ToastViewport,\n Root: ToastRoot,\n Title: ToastTitle,\n Description: ToastDescription,\n Action: ToastAction,\n Close: ToastClose,\n};\n"],"mappings":";;;;;;;;AAgDA,MAAa,0BAA0B,gBAAoC;CACzE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAkB,UAAU;CAAS;CACtD,QAAQ;EACN,OAAO;GAAE,MAAM;GAAU,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AM,UAAU,KAAK,KAAA;GACjD,8BAA4B,MAAM,UAAU,KAAK,KAAA;GAEhD;EACE,CAAA;CAER,CAAA;AAEL;AAEA,SAAgB,WAAW,EAAE,WAAW,UAAU,GAAG,SAA0B;CAC7E,OACE,oBAACA,MAAU,OAAX;EAAiB,GAAI;EAAkB;EAAW,uBAAoB;EACnE;CACc,CAAA;AAErB;AAEA,SAAgB,iBAAiB,EAAE,WAAW,UAAU,GAAG,SAAgC;CACzF,OACE,oBAACA,MAAU,aAAX;EAAuB,GAAI;EAAkB;EAAW,6BAA0B;EAC/E;CACoB,CAAA;AAE3B;AAEA,SAAgB,YAAY,EAAE,WAAW,UAAU,GAAG,SAA2B;CAC/E,OACE,oBAACA,MAAU,QAAX;EAAkB,GAAI;EAAkB;EAAW,wBAAqB;EACrE;CACe,CAAA;AAEtB;AAEA,SAAgB,WAAW,EAAE,WAAW,UAAU,GAAG,SAA0B;CAC7E,OACE,oBAACA,MAAU,OAAX;EAAiB,GAAI;EAAkB;EAAW,uBAAoB;EACnE;CACc,CAAA;AAErB;;AAGA,MAAa,WAAWA,MAAU;AAElC,MAAaC,UAAQ;CACnB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,MAAM;CACN,OAAO;CACP,aAAa;CACb,QAAQ;CACR,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"toast.js","names":["BaseToast","Toast"],"sources":["../../../src/particles/toast/toast.tsx"],"sourcesContent":["'use client';\nimport type { ToastManager, ToastRootToastObject, UseToastManagerReturnValue } from '@base-ui/react/toast';\nimport { Toast as BaseToast } from '@base-ui/react/toast';\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\nimport { Children, createContext, useContext } from 'react';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\n\n/** The queued toast object `useToast().toasts` returns and `ToastRoot` renders. */\nexport type ToastObject = ToastRootToastObject;\nexport type { ToastManager } from '@base-ui/react/toast';\n\n/** What `useOptionalToast` returns under a provider; same shape as `useToast()`. */\nexport type ToastManagerValue = UseToastManagerReturnValue;\n\n/** Set by `ToastProvider`; `null` outside one. */\nconst ToastManagerContext = createContext<ToastManagerValue | null>(null);\n\n/** Set by `ToastList` for each queued toast; read by `ToastRoot` when its `toast` prop is absent. */\nconst ToastItemContext = createContext<ToastObject | null>(null);\n\ntype SwipeDirection = 'up' | 'down' | 'left' | 'right';\n\nexport type ToastProviderProps = Readonly<{\n /** Max concurrent toasts before older ones are marked limited. */\n limit?: number;\n /** Default auto-dismiss delay (ms); `0` disables. */\n timeout?: number;\n /** External manager for triggering toasts outside React (e.g. a non-component module). */\n toastManager?: ToastManager;\n children?: ReactNode;\n}>;\n\nexport type ToastPortalProps = Readonly<{\n className?: string;\n children?: ReactNode;\n}>;\n\nexport type ToastViewportProps = Omit<ComponentPropsWithRef<'div'>, 'aria-label'> &\n MessageLocaleProp & {\n $content?: ContentValue<typeof ToastViewportContent>;\n };\n\nexport type ToastRootProps = Readonly<{\n /** The queued toast to render. Defaults to the toast `ToastList` publishes. */\n toast?: ToastObject;\n /** Directions the toast can be swiped to dismiss. @default ['down', 'right'] */\n swipeDirection?: SwipeDirection | SwipeDirection[];\n className?: string;\n children?: ReactNode;\n}>;\n\nexport type ToastListProps = Readonly<{\n /** The per-toast template, rendered once per queued toast. */\n children?: ReactNode;\n}>;\n\nexport type ToastTitleProps = ComponentPropsWithRef<'h2'>;\n\nexport type ToastDescriptionProps = ComponentPropsWithRef<'p'>;\n\nexport type ToastActionProps = ComponentPropsWithRef<'button'>;\n\nexport type ToastCloseProps = ComponentPropsWithRef<'button'>;\n\nexport const ToastProviderDefinition = defineComponent<ToastProviderProps>({\n name: 'ToastProvider',\n importPath: '@vtex/faststore/components',\n component: ToastProvider,\n editor: { label: 'Toast Provider', category: 'layout' },\n schema: {\n limit: { type: 'number', default: 3, label: 'Max Concurrent Toasts' },\n timeout: { type: 'number', default: 5000, label: 'Default Auto-Dismiss (ms)' },\n },\n providesContext: 'toast',\n guideline:\n 'Mount once at the layout root, above the Slot. Compose as: ToastProvider > ToastPortal > ToastViewport. A childless ToastViewport renders the active toasts itself; to control the markup, put a ToastList with a ToastRoot template inside it. Code raises toasts with useOptionalToast() (null without a provider) or useToast() (throws without one).',\n});\n\nexport const ToastPortalDefinition = defineComponent<ToastPortalProps>({\n name: 'ToastPortal',\n importPath: '@vtex/faststore/components',\n component: ToastPortal,\n editor: { label: 'Toast Portal', category: 'layout' },\n schema: {},\n guideline:\n 'Renders its children (ToastViewport) outside the DOM tree, into document.body. Direct child of ToastProvider.',\n});\n\nexport const ToastViewportContent = defineContentType({\n id: 'toast-viewport',\n title: 'Toast Viewport',\n description: \"Accessible names of the toast region and of each toast's close button.\",\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n regionLabel: { type: 'string', title: 'Region name', format: 'icu-message', messageSource: 'Notifications' },\n dismissLabel: { type: 'string', title: 'Close button name', format: 'icu-message', messageSource: 'Dismiss' },\n },\n },\n});\n\nexport const ToastViewportDefinition = defineComponent<ToastViewportProps>({\n name: 'ToastViewport',\n importPath: '@vtex/faststore/components',\n component: ToastViewport,\n content: ToastViewportContent,\n editor: { label: 'Toast Viewport', category: 'layout' },\n schema: {},\n guideline:\n 'The fixed-position stack container for all active toasts. With no children it renders every active toast itself (title, description, action and a close button named by its dismissLabel message), so a page schema needs only ToastProvider > ToastPortal > ToastViewport. Pass children to take control of the markup: a ToastList with a ToastRoot template is the schema-composable way (it renders the template once per queued toast), or map useToast().toasts to ToastRoot in code. Position it with a swatch on data-fs-toast-viewport (e.g. bottom-right vs. top-center). Direct child of ToastPortal.',\n});\n\nexport const ToastRootDefinition = defineComponent<ToastRootProps>({\n name: 'ToastRoot',\n importPath: '@vtex/faststore/components',\n component: ToastRoot,\n editor: { label: 'Toast Root', category: 'layout' },\n schema: {},\n requiresContext: 'toast-item',\n guideline:\n 'One instance per active toast. Inside a ToastList it is the per-toast template and reads its toast from the list; a childless ToastViewport renders its own ToastRoot per toast, so compose one only to override that. Compose as: ToastRoot > (Icon + ToastTitle + ToastDescription + ToastAction + ToastClose), all optional except at least one of Title/Description.',\n});\n\nexport const ToastListDefinition = defineComponent<ToastListProps>({\n name: 'ToastList',\n importPath: '@vtex/faststore/components',\n component: ToastList,\n editor: { label: 'Toast List', category: 'layout' },\n schema: {},\n requiresContext: 'toast',\n providesContext: 'toast-item',\n guideline:\n 'Renders its children once per queued toast; place a ToastRoot (with ToastTitle and ToastDescription, both auto-filled from the toast) inside it as the template. With no children it renders that template by default. Direct child of ToastViewport; renders nothing without a ToastProvider ancestor.',\n});\n\nexport const ToastTitleDefinition = defineComponent<ToastTitleProps>({\n name: 'ToastTitle',\n importPath: '@vtex/faststore/components',\n component: ToastTitle,\n editor: { label: 'Toast Title', category: 'layout' },\n schema: {},\n guideline: 'Renders the toast.title automatically when composed with no children. Direct child of ToastRoot.',\n});\n\nexport const ToastDescriptionDefinition = defineComponent<ToastDescriptionProps>({\n name: 'ToastDescription',\n importPath: '@vtex/faststore/components',\n component: ToastDescription,\n editor: { label: 'Toast Description', category: 'layout' },\n schema: {},\n guideline:\n 'Renders the toast.description automatically when composed with no children. Direct child of ToastRoot, after ToastTitle.',\n});\n\nexport const ToastActionDefinition = defineComponent<ToastActionProps>({\n name: 'ToastAction',\n importPath: '@vtex/faststore/components',\n component: ToastAction,\n editor: { label: 'Toast Action', category: 'action' },\n schema: {},\n guideline: \"Reversible-action button (e.g. Undo) forwarding the toast's actionProps. Omit for toasts with no action.\",\n});\n\nexport const ToastCloseDefinition = defineComponent<ToastCloseProps>({\n name: 'ToastClose',\n importPath: '@vtex/faststore/components',\n component: ToastClose,\n editor: { label: 'Toast Close', category: 'action' },\n schema: {},\n guideline: 'Dismisses the nearest ancestor ToastRoot when clicked. Can appear alongside or instead of ToastAction.',\n});\n\nexport function ToastProvider({ limit = 3, timeout = 5000, toastManager, children }: ToastProviderProps) {\n return (\n <BaseToast.Provider limit={limit} timeout={timeout} toastManager={toastManager}>\n <ToastManagerBridge>{children}</ToastManagerBridge>\n </BaseToast.Provider>\n );\n}\n\nfunction ToastManagerBridge({ children }: Readonly<{ children?: ReactNode }>) {\n const manager = BaseToast.useToastManager();\n return <ToastManagerContext.Provider value={manager}>{children}</ToastManagerContext.Provider>;\n}\n\n/** The toast manager under a `ToastProvider`, or `null` without one. Never throws. */\nexport function useOptionalToast(): ToastManagerValue | null {\n return useContext(ToastManagerContext);\n}\n\nexport function ToastList({ children }: ToastListProps) {\n const manager = useOptionalToast();\n if (!manager) return null;\n return (\n <>\n {manager.toasts.map((toast) => (\n <ToastItemContext.Provider key={toast.id} value={toast}>\n {children ?? (\n <ToastRoot>\n <ToastTitle />\n <ToastDescription />\n </ToastRoot>\n )}\n </ToastItemContext.Provider>\n ))}\n </>\n );\n}\n\nexport function ToastPortal({ className, children }: ToastPortalProps) {\n return <BaseToast.Portal className={className}>{children}</BaseToast.Portal>;\n}\n\nfunction hasChildren(children: ReactNode): boolean {\n return Children.toArray(children).length > 0;\n}\n\nfunction DefaultToastList({ dismissLabel }: Readonly<{ dismissLabel: string }>) {\n const { toasts } = useToast();\n\n return toasts.map((toast) => (\n <ToastRoot key={toast.id} toast={toast}>\n <ToastTitle />\n <ToastDescription />\n <ToastAction />\n <ToastClose aria-label={dismissLabel}>\n <span aria-hidden=\"true\">×</span>\n </ToastClose>\n </ToastRoot>\n ));\n}\n\nexport function ToastViewport({ $content, $locale, className, children, ...props }: ToastViewportProps) {\n const { format } = useMessageFormatter(ToastViewportContent, $content);\n\n return (\n <BaseToast.Viewport\n {...props}\n aria-label={format('regionLabel')}\n className={className}\n render={(renderProps, state) => (\n <div\n {...renderProps}\n data-fs-toast-viewport=\"\"\n data-fs-toast-viewport-expanded={state.expanded ? '' : undefined}\n >\n {hasChildren(children) ? children : <DefaultToastList dismissLabel={format('dismissLabel')} />}\n </div>\n )}\n />\n );\n}\n\n// Uses Base UI's `render` prop (rather than plain prop-forwarding, unlike the rest of this file) so\n// `data-fs-toast-root-type`/`-limited`/`-swiping` can mirror internal render state (`state.type`,\n// `state.limited`, `state.swiping`) that is never exposed back to us as a prop.\nexport function ToastRoot({ toast: toastProp, swipeDirection, className, children }: ToastRootProps) {\n const itemToast = useContext(ToastItemContext);\n const toast = toastProp ?? itemToast;\n if (!toast) return null;\n return (\n <BaseToast.Root\n toast={toast}\n swipeDirection={swipeDirection}\n className={className}\n render={(renderProps, state) => (\n <div\n {...renderProps}\n data-fs-toast-root=\"\"\n data-fs-toast-root-type={state.type}\n data-fs-toast-root-limited={state.limited ? '' : undefined}\n data-fs-toast-root-swiping={state.swiping ? '' : undefined}\n >\n {children}\n </div>\n )}\n />\n );\n}\n\nexport function ToastTitle({ className, children, ...props }: ToastTitleProps) {\n return (\n <BaseToast.Title {...props} className={className} data-fs-toast-title=\"\">\n {children}\n </BaseToast.Title>\n );\n}\n\nexport function ToastDescription({ className, children, ...props }: ToastDescriptionProps) {\n return (\n <BaseToast.Description {...props} className={className} data-fs-toast-description=\"\">\n {children}\n </BaseToast.Description>\n );\n}\n\nexport function ToastAction({ className, children, ...props }: ToastActionProps) {\n return (\n <BaseToast.Action {...props} className={className} data-fs-toast-action=\"\">\n {children}\n </BaseToast.Action>\n );\n}\n\nexport function ToastClose({ className, children, ...props }: ToastCloseProps) {\n return (\n <BaseToast.Close {...props} className={className} data-fs-toast-close=\"\">\n {children}\n </BaseToast.Close>\n );\n}\n\n/** Thin re-export of Base UI's `useToastManager()` — see Key Decision 1 in the spec. */\nexport const useToast = BaseToast.useToastManager;\n\nexport const Toast = {\n Provider: ToastProvider,\n Portal: ToastPortal,\n Viewport: ToastViewport,\n List: ToastList,\n Root: ToastRoot,\n Title: ToastTitle,\n Description: ToastDescription,\n Action: ToastAction,\n Close: ToastClose,\n};\n"],"mappings":";;;;;;;;;;AAgBA,MAAM,sBAAsB,cAAwC,IAAI;;AAGxE,MAAM,mBAAmB,cAAkC,IAAI;AA8C/D,MAAa,0BAA0B,gBAAoC;CACz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