@vtex/faststore 0.0.10 → 0.0.12
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 +55 -0
- package/README.md +0 -1
- package/dist/_virtual/_rolldown/runtime.js +4 -0
- package/dist/actions.json +6 -1
- package/dist/catalog.json +789 -1701
- 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 +63 -57
- package/dist/components.js +60 -54
- package/dist/content-types.json +5785 -754
- package/dist/core/dist/define-component.d.ts +1 -1
- 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-menu.md +14 -15
- package/dist/docs/account-saved-cards.md +44 -39
- 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 +5 -2
- package/dist/docs/buy-button.md +7 -8
- package/dist/docs/card-entry.md +39 -26
- package/dist/docs/card-summary.md +18 -8
- package/dist/docs/cardholder-document.md +5 -3
- package/dist/docs/carousel.md +5 -4
- package/dist/docs/cart-destination.md +39 -26
- package/dist/docs/cart-item.md +29 -14
- package/dist/docs/cart-totalizer.md +7 -5
- package/dist/docs/cart.md +135 -41
- 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/form.md +54 -18
- package/dist/docs/free-shipping-progress.md +6 -5
- package/dist/docs/identity-edit.md +8 -2
- package/dist/docs/identity-summary.md +18 -5
- package/dist/docs/installments.md +46 -32
- 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 +30 -4
- package/dist/docs/payment-methods.md +1 -1
- 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 +13 -9
- package/dist/docs/product-list.md +7 -6
- package/dist/docs/product-shelf.md +0 -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/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 +4 -2
- package/dist/docs/sign-in.md +173 -0
- package/dist/docs/toast.md +15 -4
- package/dist/docs/variant-selector.md +15 -11
- package/dist/domain-logic/dist/checkout/rules.js +33 -0
- package/dist/domain-logic/dist/checkout/rules.js.map +1 -0
- package/dist/graphql/types.d.ts +4 -14
- package/dist/index.d.ts +2 -2
- package/dist/internal/client.d.ts +1 -3
- package/dist/internal/client.js +1 -1
- package/dist/internal/server.d.ts +7 -4
- package/dist/internal/server.js +7 -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 +108 -28
- package/dist/matter/account-saved-cards/account-saved-cards.js +177 -122
- package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -1
- 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 +7 -1
- package/dist/matter/cart/cart-namespace.js +7 -1
- package/dist/matter/cart/cart-namespace.js.map +1 -1
- package/dist/matter/cart/cart.d.ts +402 -61
- package/dist/matter/cart/cart.js +624 -153
- package/dist/matter/cart/cart.js.map +1 -1
- package/dist/matter/cart-destination/cart-destination.d.ts +30 -19
- package/dist/matter/cart-destination/cart-destination.js +160 -70
- package/dist/matter/cart-destination/cart-destination.js.map +1 -1
- package/dist/matter/cart-item/cart-item.d.ts +144 -17
- package/dist/matter/cart-item/cart-item.js +166 -49
- 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 +46 -17
- 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 +79 -7
- package/dist/matter/free-shipping-progress/free-shipping-progress.js +77 -20
- 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 +1 -3
- package/dist/matter/product-shelf/product-shelf.js +2 -15
- 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 +250 -24
- package/dist/matter/shipping-simulator/shipping-simulator.js +257 -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 +29 -8
- package/dist/particles/binding-switcher/binding-switcher.js +37 -26
- package/dist/particles/binding-switcher/binding-switcher.js.map +1 -1
- package/dist/particles/card-summary/card-summary.d.ts +38 -8
- package/dist/particles/card-summary/card-summary.js +55 -22
- package/dist/particles/card-summary/card-summary.js.map +1 -1
- 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/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/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/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 +29 -3
- package/dist/particles/toast/toast.js +34 -10
- package/dist/particles/toast/toast.js.map +1 -1
- package/dist/schema.graphql +164 -56
- 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/cart/use-cart-actions.js.map +1 -1
- 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 +1 -1
- package/dist/sdk/generated/gql.js.map +1 -1
- package/dist/sdk/generated/graphql.d.ts +20 -5
- package/dist/sdk/generated/graphql.js +6 -0
- 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/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 +21 -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 -4
- 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/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 +3 -2
- package/dist/sdk/seo/page-alternates.js +4 -2
- 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/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/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 +8 -0
- 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 -183
- package/dist/sdk/i18n/messages/en-US.js.map +0 -1
- package/dist/sdk/i18n/messages/en-US.json +0 -178
- package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -182
- package/dist/sdk/i18n/messages/es-ES.js +0 -183
- package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
- package/dist/sdk/i18n/messages/es-ES.json +0 -178
- package/dist/sdk/i18n/messages/pt-BR.js +0 -183
- package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
- package/dist/sdk/i18n/messages/pt-BR.json +0 -178
- 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
|
@@ -26,7 +26,7 @@ const SwitchThumbDefinition = defineComponent({
|
|
|
26
26
|
schema: {},
|
|
27
27
|
guideline: "Sliding visual indicator inside Switch.Root. Moves position based on the checked state managed by Base UI."
|
|
28
28
|
});
|
|
29
|
-
function SwitchRoot({ checked, defaultChecked, onCheckedChange, disabled, readOnly, required, name, id, className, children }) {
|
|
29
|
+
function SwitchRoot({ checked, defaultChecked, onCheckedChange, disabled, readOnly, required, name, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, children }) {
|
|
30
30
|
return /* @__PURE__ */ jsx(Switch.Root, {
|
|
31
31
|
checked,
|
|
32
32
|
defaultChecked,
|
|
@@ -36,6 +36,8 @@ function SwitchRoot({ checked, defaultChecked, onCheckedChange, disabled, readOn
|
|
|
36
36
|
required,
|
|
37
37
|
name,
|
|
38
38
|
id,
|
|
39
|
+
"aria-label": ariaLabel,
|
|
40
|
+
"aria-labelledby": ariaLabelledBy,
|
|
39
41
|
className,
|
|
40
42
|
"data-fs-switch-root": "",
|
|
41
43
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","names":["BaseSwitch","Switch"],"sources":["../../../src/particles/switch/switch.tsx"],"sourcesContent":["'use client';\nimport { Switch as BaseSwitch } from '@base-ui/react/switch';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\n\nexport type SwitchRootProps = {\n checked?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n name?: string;\n id?: string;\n className?: string;\n children?: ReactNode;\n};\n\nexport type SwitchThumbProps = ComponentPropsWithRef<'span'>;\n\nexport const SwitchRootDefinition = defineComponent<SwitchRootProps>({\n name: 'SwitchRoot',\n importPath: '@vtex/faststore/components',\n component: SwitchRoot,\n editor: { label: 'Switch Root', category: 'action' },\n schema: {},\n guideline:\n 'On/off control for settings and preferences. Always wraps a Switch.Thumb. Unlike Checkbox, implies immediate effect without form submission. Style the checked state via data-checked.',\n});\n\nexport const SwitchThumbDefinition = defineComponent<SwitchThumbProps>({\n name: 'SwitchThumb',\n importPath: '@vtex/faststore/components',\n component: SwitchThumb,\n editor: { label: 'Switch Thumb', category: 'layout' },\n schema: {},\n guideline:\n 'Sliding visual indicator inside Switch.Root. Moves position based on the checked state managed by Base UI.',\n});\n\nexport function SwitchRoot({\n checked,\n defaultChecked,\n onCheckedChange,\n disabled,\n readOnly,\n required,\n name,\n id,\n className,\n children,\n}: SwitchRootProps) {\n return (\n <BaseSwitch.Root\n checked={checked}\n defaultChecked={defaultChecked}\n onCheckedChange={onCheckedChange}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n id={id}\n className={className}\n data-fs-switch-root=\"\"\n >\n {children}\n </BaseSwitch.Root>\n );\n}\n\nexport function SwitchThumb({ className, children, ...props }: SwitchThumbProps) {\n return (\n <BaseSwitch.Thumb {...props} className={className} data-fs-switch-thumb=\"\">\n {children}\n </BaseSwitch.Thumb>\n );\n}\n\nexport const Switch = {\n Root: SwitchRoot,\n Thumb: SwitchThumb,\n};\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"switch.js","names":["BaseSwitch","Switch"],"sources":["../../../src/particles/switch/switch.tsx"],"sourcesContent":["'use client';\nimport { Switch as BaseSwitch } from '@base-ui/react/switch';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\n\nexport type SwitchRootProps = {\n checked?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n name?: string;\n id?: string;\n /** Accessible name when no visible label is bound to the switch. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n children?: ReactNode;\n};\n\nexport type SwitchThumbProps = ComponentPropsWithRef<'span'>;\n\nexport const SwitchRootDefinition = defineComponent<SwitchRootProps>({\n name: 'SwitchRoot',\n importPath: '@vtex/faststore/components',\n component: SwitchRoot,\n editor: { label: 'Switch Root', category: 'action' },\n schema: {},\n guideline:\n 'On/off control for settings and preferences. Always wraps a Switch.Thumb. Unlike Checkbox, implies immediate effect without form submission. Style the checked state via data-checked.',\n});\n\nexport const SwitchThumbDefinition = defineComponent<SwitchThumbProps>({\n name: 'SwitchThumb',\n importPath: '@vtex/faststore/components',\n component: SwitchThumb,\n editor: { label: 'Switch Thumb', category: 'layout' },\n schema: {},\n guideline:\n 'Sliding visual indicator inside Switch.Root. Moves position based on the checked state managed by Base UI.',\n});\n\nexport function SwitchRoot({\n checked,\n defaultChecked,\n onCheckedChange,\n disabled,\n readOnly,\n required,\n name,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className,\n children,\n}: Readonly<SwitchRootProps>) {\n return (\n <BaseSwitch.Root\n checked={checked}\n defaultChecked={defaultChecked}\n onCheckedChange={onCheckedChange}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n id={id}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={className}\n data-fs-switch-root=\"\"\n >\n {children}\n </BaseSwitch.Root>\n );\n}\n\nexport function SwitchThumb({ className, children, ...props }: SwitchThumbProps) {\n return (\n <BaseSwitch.Thumb {...props} className={className} data-fs-switch-thumb=\"\">\n {children}\n </BaseSwitch.Thumb>\n );\n}\n\nexport const Switch = {\n Root: SwitchRoot,\n Thumb: SwitchThumb,\n};\n"],"mappings":";;;;;;AAuBA,MAAa,uBAAuB,gBAAiC;CACnE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAe,UAAU;CAAS;CACnD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,wBAAwB,gBAAkC;CACrE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAgB,UAAU;CAAS;CACpD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,SAAgB,WAAW,EACzB,SACA,gBACA,iBACA,UACA,UACA,UACA,MACA,IACA,cAAc,WACd,mBAAmB,gBACnB,WACA,YAC4B;CAC5B,OACE,oBAACA,OAAW,MAAZ;EACW;EACO;EACC;EACP;EACA;EACA;EACJ;EACF;EACJ,cAAY;EACZ,mBAAiB;EACN;EACX,uBAAoB;EAEnB;CACc,CAAA;AAErB;AAEA,SAAgB,YAAY,EAAE,WAAW,UAAU,GAAG,SAA2B;CAC/E,OACE,oBAACA,OAAW,OAAZ;EAAkB,GAAI;EAAkB;EAAW,wBAAqB;EACrE;CACe,CAAA;AAEtB;AAEA,MAAaC,WAAS;CACpB,MAAM;CACN,OAAO;AACT"}
|
|
@@ -1,3 +1,4 @@
|
|
|
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";
|
|
@@ -21,7 +22,9 @@ export type ToastPortalProps = Readonly<{
|
|
|
21
22
|
className?: string;
|
|
22
23
|
children?: ReactNode;
|
|
23
24
|
}>;
|
|
24
|
-
export type ToastViewportProps = ComponentPropsWithRef<'div'
|
|
25
|
+
export type ToastViewportProps = Omit<ComponentPropsWithRef<'div'>, 'aria-label'> & MessageLocaleProp & {
|
|
26
|
+
$content?: ContentValue<typeof ToastViewportContent>;
|
|
27
|
+
};
|
|
25
28
|
export type ToastRootProps = Readonly<{
|
|
26
29
|
/** The queued toast to render. Defaults to the toast `ToastList` publishes. */
|
|
27
30
|
toast?: ToastObject;
|
|
@@ -51,7 +54,30 @@ export declare const ToastPortalDefinition: ComponentDefinition<Readonly<{
|
|
|
51
54
|
className?: string;
|
|
52
55
|
children?: ReactNode;
|
|
53
56
|
}>>;
|
|
54
|
-
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>;
|
|
55
81
|
export declare const ToastRootDefinition: ComponentDefinition<Readonly<{
|
|
56
82
|
/** The queued toast to render. Defaults to the toast `ToastList` publishes. */
|
|
57
83
|
toast?: ToastObject;
|
|
@@ -73,7 +99,7 @@ export declare function ToastProvider({ limit, timeout, toastManager, children }
|
|
|
73
99
|
export declare function useOptionalToast(): ToastManagerValue | null;
|
|
74
100
|
export declare function ToastList({ children }: ToastListProps): import("react/jsx-runtime").JSX.Element | null;
|
|
75
101
|
export declare function ToastPortal({ className, children }: ToastPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
76
|
-
export declare function ToastViewport({
|
|
102
|
+
export declare function ToastViewport({ $content, $locale, className, children, ...props }: ToastViewportProps): import("react/jsx-runtime").JSX.Element;
|
|
77
103
|
export declare function ToastRoot({ toast: toastProp, swipeDirection, className, children }: ToastRootProps): import("react/jsx-runtime").JSX.Element | null;
|
|
78
104
|
export declare function ToastTitle({ className, children, ...props }: ToastTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
79
105
|
export declare function ToastDescription({ className, children, ...props }: ToastDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
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 { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
|
|
5
6
|
import { Children, createContext, useContext } from "react";
|
|
6
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { Toast } from "@base-ui/react/toast";
|
|
@@ -44,16 +45,40 @@ const ToastPortalDefinition = defineComponent({
|
|
|
44
45
|
schema: {},
|
|
45
46
|
guideline: "Renders its children (ToastViewport) outside the DOM tree, into document.body. Direct child of ToastProvider."
|
|
46
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
|
+
});
|
|
47
71
|
const ToastViewportDefinition = defineComponent({
|
|
48
72
|
name: "ToastViewport",
|
|
49
73
|
importPath: "@vtex/faststore/components",
|
|
50
74
|
component: ToastViewport,
|
|
75
|
+
content: ToastViewportContent,
|
|
51
76
|
editor: {
|
|
52
77
|
label: "Toast Viewport",
|
|
53
78
|
category: "layout"
|
|
54
79
|
},
|
|
55
80
|
schema: {},
|
|
56
|
-
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."
|
|
57
82
|
});
|
|
58
83
|
const ToastRootDefinition = defineComponent({
|
|
59
84
|
name: "ToastRoot",
|
|
@@ -160,8 +185,7 @@ function ToastPortal({ className, children }) {
|
|
|
160
185
|
function hasChildren(children) {
|
|
161
186
|
return Children.toArray(children).length > 0;
|
|
162
187
|
}
|
|
163
|
-
function DefaultToastList() {
|
|
164
|
-
const intl = useIntl();
|
|
188
|
+
function DefaultToastList({ dismissLabel }) {
|
|
165
189
|
const { toasts } = useToast();
|
|
166
190
|
return toasts.map((toast) => /* @__PURE__ */ jsxs(ToastRoot, {
|
|
167
191
|
toast,
|
|
@@ -170,7 +194,7 @@ function DefaultToastList() {
|
|
|
170
194
|
/* @__PURE__ */ jsx(ToastDescription, {}),
|
|
171
195
|
/* @__PURE__ */ jsx(ToastAction, {}),
|
|
172
196
|
/* @__PURE__ */ jsx(ToastClose, {
|
|
173
|
-
"aria-label":
|
|
197
|
+
"aria-label": dismissLabel,
|
|
174
198
|
children: /* @__PURE__ */ jsx("span", {
|
|
175
199
|
"aria-hidden": "true",
|
|
176
200
|
children: "×"
|
|
@@ -179,17 +203,17 @@ function DefaultToastList() {
|
|
|
179
203
|
]
|
|
180
204
|
}, toast.id));
|
|
181
205
|
}
|
|
182
|
-
function ToastViewport({
|
|
183
|
-
const
|
|
206
|
+
function ToastViewport({ $content, $locale, className, children, ...props }) {
|
|
207
|
+
const { format } = useMessageFormatter(ToastViewportContent, $content);
|
|
184
208
|
return /* @__PURE__ */ jsx(Toast.Viewport, {
|
|
185
209
|
...props,
|
|
186
|
-
"aria-label":
|
|
210
|
+
"aria-label": format("regionLabel"),
|
|
187
211
|
className,
|
|
188
212
|
render: (renderProps, state) => /* @__PURE__ */ jsx("div", {
|
|
189
213
|
...renderProps,
|
|
190
214
|
"data-fs-toast-viewport": "",
|
|
191
215
|
"data-fs-toast-viewport-expanded": state.expanded ? "" : void 0,
|
|
192
|
-
children: hasChildren(children) ? children : /* @__PURE__ */ jsx(DefaultToastList, {})
|
|
216
|
+
children: hasChildren(children) ? children : /* @__PURE__ */ jsx(DefaultToastList, { dismissLabel: format("dismissLabel") })
|
|
193
217
|
})
|
|
194
218
|
});
|
|
195
219
|
}
|
|
@@ -257,6 +281,6 @@ const Toast$1 = {
|
|
|
257
281
|
Close: ToastClose
|
|
258
282
|
};
|
|
259
283
|
//#endregion
|
|
260
|
-
export { Toast$1 as Toast, ToastAction, ToastActionDefinition, ToastClose, ToastCloseDefinition, ToastDescription, ToastDescriptionDefinition, ToastList, ToastListDefinition, ToastPortal, ToastPortalDefinition, ToastProvider, ToastProviderDefinition, ToastRoot, ToastRootDefinition, ToastTitle, ToastTitleDefinition, ToastViewport, ToastViewportDefinition, useOptionalToast, 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 };
|
|
261
285
|
|
|
262
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, UseToastManagerReturnValue } 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, createContext, useContext } 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\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 = ComponentPropsWithRef<'div'>;\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 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 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() {\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: 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;AA2C/D,MAAa,0BAA0B,gBAAoC;CACzE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAkB,UAAU;CAAS;CACtD,QAAQ;EACN,OAAO;GAAE,MAAM;GAAU,SAAS;GAAG,OAAO;EAAwB;EACpE,SAAS;GAAE,MAAM;GAAU,SAAS;GAAM,OAAO;EAA4B;CAC/E;CACA,iBAAiB;CACjB,WACE;AACJ,CAAC;AAED,MAAa,wBAAwB,gBAAkC;CACrE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAgB,UAAU;CAAS;CACpD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,0BAA0B,gBAAoC;CACzE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAA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,MAAU;AAElC,MAAaC,UAAQ;CACnB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,MAAM;CACN,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;CACzE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAkB,UAAU;CAAS;CACtD,QAAQ;EACN,OAAO;GAAE,MAAM;GAAU,SAAS;GAAG,OAAO;EAAwB;EACpE,SAAS;GAAE,MAAM;GAAU,SAAS;GAAM,OAAO;EAA4B;CAC/E;CACA,iBAAiB;CACjB,WACE;AACJ,CAAC;AAED,MAAa,wBAAwB,gBAAkC;CACrE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAgB,UAAU;CAAS;CACpD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,uBAAuB,kBAAkB;CACpD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY;GACV,aAAa;IAAE,MAAM;IAAU,OAAO;IAAe,QAAQ;IAAe,eAAe;GAAgB;GAC3G,cAAc;IAAE,MAAM;IAAU,OAAO;IAAqB,QAAQ;IAAe,eAAe;GAAU;EAC9G;CACF;AACF,CAAC;AAED,MAAa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