@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
|
@@ -1,16 +1,93 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import { defineContentType } from "../../core/dist/define-content-type.js";
|
|
3
4
|
import "../../core/dist/index.js";
|
|
5
|
+
import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
|
|
4
6
|
import { Children, createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
5
7
|
import { jsx } from "react/jsx-runtime";
|
|
6
8
|
//#region src/particles/carousel/carousel.tsx
|
|
9
|
+
const CarouselRootContent = defineContentType({
|
|
10
|
+
id: "carousel-root",
|
|
11
|
+
title: "Carousel Root",
|
|
12
|
+
description: "Accessible name of the carousel region.",
|
|
13
|
+
schema: {
|
|
14
|
+
type: "object",
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
properties: { label: {
|
|
17
|
+
type: "string",
|
|
18
|
+
title: "Accessible label",
|
|
19
|
+
format: "icu-message",
|
|
20
|
+
messageSource: "Carousel"
|
|
21
|
+
} }
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const CarouselPreviousContent = defineContentType({
|
|
25
|
+
id: "carousel-previous",
|
|
26
|
+
title: "Carousel Previous",
|
|
27
|
+
description: "Accessible name of the previous-page control.",
|
|
28
|
+
schema: {
|
|
29
|
+
type: "object",
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
properties: { label: {
|
|
32
|
+
type: "string",
|
|
33
|
+
title: "Accessible label",
|
|
34
|
+
format: "icu-message",
|
|
35
|
+
messageSource: "Previous"
|
|
36
|
+
} }
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const CarouselNextContent = defineContentType({
|
|
40
|
+
id: "carousel-next",
|
|
41
|
+
title: "Carousel Next",
|
|
42
|
+
description: "Accessible name of the next-page control.",
|
|
43
|
+
schema: {
|
|
44
|
+
type: "object",
|
|
45
|
+
additionalProperties: false,
|
|
46
|
+
properties: { label: {
|
|
47
|
+
type: "string",
|
|
48
|
+
title: "Accessible label",
|
|
49
|
+
format: "icu-message",
|
|
50
|
+
messageSource: "Next"
|
|
51
|
+
} }
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const CarouselBulletsContent = defineContentType({
|
|
55
|
+
id: "carousel-bullets",
|
|
56
|
+
title: "Carousel Bullets",
|
|
57
|
+
description: "Accessible names of the page bullets and of their group.",
|
|
58
|
+
schema: {
|
|
59
|
+
type: "object",
|
|
60
|
+
additionalProperties: false,
|
|
61
|
+
properties: {
|
|
62
|
+
ariaLabel: {
|
|
63
|
+
type: "string",
|
|
64
|
+
title: "Group accessible label",
|
|
65
|
+
format: "icu-message",
|
|
66
|
+
messageSource: "Choose page"
|
|
67
|
+
},
|
|
68
|
+
bulletLabel: {
|
|
69
|
+
type: "string",
|
|
70
|
+
title: "Bullet accessible label",
|
|
71
|
+
description: "The page argument is the 1-based page number.",
|
|
72
|
+
format: "icu-message",
|
|
73
|
+
messageSource: "Go to page {page}",
|
|
74
|
+
messageArguments: {
|
|
75
|
+
type: "object",
|
|
76
|
+
properties: { page: { type: "integer" } }
|
|
77
|
+
},
|
|
78
|
+
messageExample: { page: 2 }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
7
83
|
const CarouselContext = createContext(null);
|
|
8
84
|
function useCarousel() {
|
|
9
85
|
const ctx = useContext(CarouselContext);
|
|
10
86
|
if (!ctx) throw new Error("Carousel components must be used inside CarouselRoot.");
|
|
11
87
|
return ctx;
|
|
12
88
|
}
|
|
13
|
-
function CarouselRoot({ infiniteMode = false, variant = "slide", itemsPerPage = 1, defaultPage = 0,
|
|
89
|
+
function CarouselRoot({ infiniteMode = false, variant = "slide", itemsPerPage = 1, defaultPage = 0, $locale, $content, children, ...props }) {
|
|
90
|
+
const messages = useMessageFormatter(CarouselRootContent, $content);
|
|
14
91
|
const [currentPage, setCurrentPage] = useState(defaultPage);
|
|
15
92
|
const [itemCount, setItemCountState] = useState(0);
|
|
16
93
|
const perPage = Math.max(1, itemsPerPage);
|
|
@@ -67,7 +144,7 @@ function CarouselRoot({ infiniteMode = false, variant = "slide", itemsPerPage =
|
|
|
67
144
|
"data-fs-carousel": "",
|
|
68
145
|
"data-fs-carousel-variant": variant,
|
|
69
146
|
"aria-roledescription": "carousel",
|
|
70
|
-
"aria-label": label,
|
|
147
|
+
"aria-label": messages.format("label"),
|
|
71
148
|
children
|
|
72
149
|
})
|
|
73
150
|
});
|
|
@@ -152,8 +229,9 @@ function CarouselTrack({ children, style, ref, onScroll, ...props }) {
|
|
|
152
229
|
})
|
|
153
230
|
});
|
|
154
231
|
}
|
|
155
|
-
function CarouselPrevious({ children, onClick, ...props }) {
|
|
232
|
+
function CarouselPrevious({ $locale, $content, children, onClick, ...props }) {
|
|
156
233
|
const { previous, canGoPrevious } = useCarousel();
|
|
234
|
+
const messages = useMessageFormatter(CarouselPreviousContent, $content);
|
|
157
235
|
return /* @__PURE__ */ jsx("button", {
|
|
158
236
|
type: "button",
|
|
159
237
|
disabled: !canGoPrevious,
|
|
@@ -161,14 +239,15 @@ function CarouselPrevious({ children, onClick, ...props }) {
|
|
|
161
239
|
onClick?.(event);
|
|
162
240
|
if (!event.defaultPrevented) previous();
|
|
163
241
|
},
|
|
164
|
-
"aria-label": "
|
|
242
|
+
"aria-label": messages.format("label"),
|
|
165
243
|
"data-fs-carousel-previous": "",
|
|
166
244
|
...props,
|
|
167
245
|
children
|
|
168
246
|
});
|
|
169
247
|
}
|
|
170
|
-
function CarouselNext({ children, onClick, ...props }) {
|
|
248
|
+
function CarouselNext({ $locale, $content, children, onClick, ...props }) {
|
|
171
249
|
const { next, canGoNext } = useCarousel();
|
|
250
|
+
const messages = useMessageFormatter(CarouselNextContent, $content);
|
|
172
251
|
return /* @__PURE__ */ jsx("button", {
|
|
173
252
|
type: "button",
|
|
174
253
|
disabled: !canGoNext,
|
|
@@ -176,15 +255,17 @@ function CarouselNext({ children, onClick, ...props }) {
|
|
|
176
255
|
onClick?.(event);
|
|
177
256
|
if (!event.defaultPrevented) next();
|
|
178
257
|
},
|
|
179
|
-
"aria-label": "
|
|
258
|
+
"aria-label": messages.format("label"),
|
|
180
259
|
"data-fs-carousel-next": "",
|
|
181
260
|
...props,
|
|
182
261
|
children
|
|
183
262
|
});
|
|
184
263
|
}
|
|
185
|
-
function CarouselBullets({
|
|
264
|
+
function CarouselBullets({ $locale, $content, hideWhenSingle = true, ...props }) {
|
|
186
265
|
const { totalPages, currentPage, goToPage } = useCarousel();
|
|
266
|
+
const messages = useMessageFormatter(CarouselBulletsContent, $content);
|
|
187
267
|
if (hideWhenSingle && totalPages <= 1) return null;
|
|
268
|
+
const ariaLabel = messages.format("ariaLabel");
|
|
188
269
|
function handleKeyDown(event, page) {
|
|
189
270
|
let target = page;
|
|
190
271
|
switch (event.key) {
|
|
@@ -215,7 +296,7 @@ function CarouselBullets({ ariaLabel = "Choose page", bulletLabel = "Go to page
|
|
|
215
296
|
const isActive = page === currentPage;
|
|
216
297
|
return /* @__PURE__ */ jsx("button", {
|
|
217
298
|
type: "button",
|
|
218
|
-
"aria-label":
|
|
299
|
+
"aria-label": messages.format("bulletLabel", { page: page + 1 }),
|
|
219
300
|
"aria-current": isActive,
|
|
220
301
|
"data-fs-carousel-bullet": "",
|
|
221
302
|
"data-fs-carousel-bullet-selected": String(isActive),
|
|
@@ -229,6 +310,7 @@ const CarouselRootDefinition = defineComponent({
|
|
|
229
310
|
name: "CarouselRoot",
|
|
230
311
|
importPath: "@vtex/faststore/components",
|
|
231
312
|
component: CarouselRoot,
|
|
313
|
+
content: CarouselRootContent,
|
|
232
314
|
editor: {
|
|
233
315
|
label: "Carousel Root",
|
|
234
316
|
category: "layout"
|
|
@@ -253,14 +335,9 @@ const CarouselRootDefinition = defineComponent({
|
|
|
253
335
|
type: "number",
|
|
254
336
|
default: 0,
|
|
255
337
|
label: "Default Page"
|
|
256
|
-
},
|
|
257
|
-
label: {
|
|
258
|
-
type: "string",
|
|
259
|
-
default: "Carousel",
|
|
260
|
-
label: "Aria Label"
|
|
261
338
|
}
|
|
262
339
|
},
|
|
263
|
-
guideline: "Root of the carousel. Provides paging state to all parts. Compose as: CarouselRoot > (CarouselTrack > [item children] + CarouselPrevious + CarouselNext + CarouselBullets). Set infiniteMode=true to loop seamlessly (arrows never disable); variant=\"scroll\" for native overflow, \"slide\" for transform transitions. itemsPerPage sets how many children are visible per page. Holds no product or media data — nest any children in CarouselTrack."
|
|
340
|
+
guideline: "Root of the carousel. Provides paging state to all parts. Compose as: CarouselRoot > (CarouselTrack > [item children] + CarouselPrevious + CarouselNext + CarouselBullets). Set infiniteMode=true to loop seamlessly (arrows never disable); variant=\"scroll\" for native overflow, \"slide\" for transform transitions. itemsPerPage sets how many children are visible per page. Its accessible name comes from the $content field label. Holds no product or media data — nest any children in CarouselTrack."
|
|
264
341
|
});
|
|
265
342
|
const CarouselTrackDefinition = defineComponent({
|
|
266
343
|
name: "CarouselTrack",
|
|
@@ -277,50 +354,41 @@ const CarouselPreviousDefinition = defineComponent({
|
|
|
277
354
|
name: "CarouselPrevious",
|
|
278
355
|
importPath: "@vtex/faststore/components",
|
|
279
356
|
component: CarouselPrevious,
|
|
357
|
+
content: CarouselPreviousContent,
|
|
280
358
|
editor: {
|
|
281
359
|
label: "Carousel Previous",
|
|
282
360
|
category: "action"
|
|
283
361
|
},
|
|
284
362
|
schema: {},
|
|
285
|
-
guideline: "Moves the track one page backward. Disabled on the first page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the last page). Accepts any children (Icon, text). Must be inside CarouselRoot."
|
|
363
|
+
guideline: "Moves the track one page backward. Disabled on the first page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the last page). Accepts any children (Icon, text); its accessible name comes from the $content field label. Must be inside CarouselRoot."
|
|
286
364
|
});
|
|
287
365
|
const CarouselNextDefinition = defineComponent({
|
|
288
366
|
name: "CarouselNext",
|
|
289
367
|
importPath: "@vtex/faststore/components",
|
|
290
368
|
component: CarouselNext,
|
|
369
|
+
content: CarouselNextContent,
|
|
291
370
|
editor: {
|
|
292
371
|
label: "Carousel Next",
|
|
293
372
|
category: "action"
|
|
294
373
|
},
|
|
295
374
|
schema: {},
|
|
296
|
-
guideline: "Moves the track one page forward. Disabled on the last page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the first page). Accepts any children (Icon, text). Must be inside CarouselRoot."
|
|
375
|
+
guideline: "Moves the track one page forward. Disabled on the last page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the first page). Accepts any children (Icon, text); its accessible name comes from the $content field label. Must be inside CarouselRoot."
|
|
297
376
|
});
|
|
298
377
|
const CarouselBulletsDefinition = defineComponent({
|
|
299
378
|
name: "CarouselBullets",
|
|
300
379
|
importPath: "@vtex/faststore/components",
|
|
301
380
|
component: CarouselBullets,
|
|
381
|
+
content: CarouselBulletsContent,
|
|
302
382
|
editor: {
|
|
303
383
|
label: "Carousel Bullets",
|
|
304
384
|
category: "action"
|
|
305
385
|
},
|
|
306
|
-
schema: {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
bulletLabel: {
|
|
313
|
-
type: "string",
|
|
314
|
-
default: "Go to page {page}",
|
|
315
|
-
label: "Bullet Label Template"
|
|
316
|
-
},
|
|
317
|
-
hideWhenSingle: {
|
|
318
|
-
type: "boolean",
|
|
319
|
-
default: true,
|
|
320
|
-
label: "Hide when single page"
|
|
321
|
-
}
|
|
322
|
-
},
|
|
323
|
-
guideline: "Renders one bullet button per page and marks the active page. Supports ArrowLeft/ArrowRight/Home/End keyboard navigation. Returns null when there is a single page unless hideWhenSingle={false}. Use {page} in bulletLabel for the 1-based page number. Must be inside CarouselRoot."
|
|
386
|
+
schema: { hideWhenSingle: {
|
|
387
|
+
type: "boolean",
|
|
388
|
+
default: true,
|
|
389
|
+
label: "Hide when single page"
|
|
390
|
+
} },
|
|
391
|
+
guideline: "Renders one bullet button per page and marks the active page. Supports ArrowLeft/ArrowRight/Home/End keyboard navigation. Returns null when there is a single page unless hideWhenSingle={false}. The group accessible name is the $content field ariaLabel; each bullet takes bulletLabel, whose page argument is the 1-based page number. Must be inside CarouselRoot."
|
|
324
392
|
});
|
|
325
393
|
const Carousel = {
|
|
326
394
|
Root: CarouselRoot,
|
|
@@ -330,6 +398,6 @@ const Carousel = {
|
|
|
330
398
|
Bullets: CarouselBullets
|
|
331
399
|
};
|
|
332
400
|
//#endregion
|
|
333
|
-
export { Carousel, CarouselBullets, CarouselBulletsDefinition, CarouselNext, CarouselNextDefinition, CarouselPrevious, CarouselPreviousDefinition, CarouselRoot, CarouselRootDefinition, CarouselTrack, CarouselTrackDefinition, useCarousel };
|
|
401
|
+
export { Carousel, CarouselBullets, CarouselBulletsContent, CarouselBulletsDefinition, CarouselNext, CarouselNextContent, CarouselNextDefinition, CarouselPrevious, CarouselPreviousContent, CarouselPreviousDefinition, CarouselRoot, CarouselRootContent, CarouselRootDefinition, CarouselTrack, CarouselTrackDefinition, useCarousel };
|
|
334
402
|
|
|
335
403
|
//# sourceMappingURL=carousel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","names":[],"sources":["../../../src/particles/carousel/carousel.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport {\n Children,\n type ComponentPropsWithRef,\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nexport type CarouselVariant = 'slide' | 'scroll';\n\nexport type CarouselContextValue = {\n currentPage: number;\n itemCount: number;\n itemsPerPage: number;\n totalPages: number;\n variant: CarouselVariant;\n infiniteMode: boolean;\n goToPage: (page: number) => void;\n next: () => void;\n previous: () => void;\n canGoNext: boolean;\n canGoPrevious: boolean;\n setItemCount: (count: number) => void;\n};\n\nexport type CarouselRootProps = ComponentPropsWithRef<'section'> & {\n infiniteMode?: boolean;\n variant?: CarouselVariant;\n itemsPerPage?: number;\n defaultPage?: number;\n label?: string;\n};\n\nexport type CarouselTrackProps = ComponentPropsWithRef<'div'> & {\n children?: ReactNode;\n};\n\nexport type CarouselPreviousProps = ComponentPropsWithRef<'button'> & {\n children?: ReactNode;\n};\n\nexport type CarouselNextProps = ComponentPropsWithRef<'button'> & {\n children?: ReactNode;\n};\n\nexport type CarouselBulletsProps = ComponentPropsWithRef<'div'> & {\n ariaLabel?: string;\n bulletLabel?: string;\n hideWhenSingle?: boolean;\n};\n\nconst CarouselContext = createContext<CarouselContextValue | null>(null);\n\nexport function useCarousel(): CarouselContextValue {\n const ctx = useContext(CarouselContext);\n if (!ctx) throw new Error('Carousel components must be used inside CarouselRoot.');\n return ctx;\n}\n\nexport function CarouselRoot({\n infiniteMode = false,\n variant = 'slide',\n itemsPerPage = 1,\n defaultPage = 0,\n label = 'Carousel',\n children,\n ...props\n}: CarouselRootProps) {\n const [currentPage, setCurrentPage] = useState(defaultPage);\n const [itemCount, setItemCountState] = useState(0);\n\n const perPage = Math.max(1, itemsPerPage);\n const totalPages = Math.max(1, Math.ceil(itemCount / perPage));\n\n const setItemCount = useCallback((count: number) => {\n setItemCountState((prev) => (prev === count ? prev : count));\n }, []);\n\n // Keep the current page in range when the number of pages shrinks.\n useEffect(() => {\n if (itemCount === 0) return;\n setCurrentPage((page) => Math.min(page, totalPages - 1));\n }, [itemCount, totalPages]);\n\n const goToPage = useCallback(\n (page: number) => {\n setCurrentPage(Math.max(0, Math.min(page, totalPages - 1)));\n },\n [totalPages],\n );\n\n const next = useCallback(() => {\n setCurrentPage((page) => (infiniteMode ? (page + 1) % totalPages : Math.min(page + 1, totalPages - 1)));\n }, [infiniteMode, totalPages]);\n\n const previous = useCallback(() => {\n setCurrentPage((page) => (infiniteMode ? (page - 1 + totalPages) % totalPages : Math.max(page - 1, 0)));\n }, [infiniteMode, totalPages]);\n\n const canGoNext = infiniteMode ? totalPages > 1 : currentPage < totalPages - 1;\n const canGoPrevious = infiniteMode ? totalPages > 1 : currentPage > 0;\n\n const ctx = useMemo<CarouselContextValue>(\n () => ({\n currentPage,\n itemCount,\n itemsPerPage: perPage,\n totalPages,\n variant,\n infiniteMode,\n goToPage,\n next,\n previous,\n canGoNext,\n canGoPrevious,\n setItemCount,\n }),\n [\n currentPage,\n itemCount,\n perPage,\n totalPages,\n variant,\n infiniteMode,\n goToPage,\n next,\n previous,\n canGoNext,\n canGoPrevious,\n setItemCount,\n ],\n );\n\n return (\n <CarouselContext value={ctx}>\n <section\n {...props}\n data-fs-carousel=\"\"\n data-fs-carousel-variant={variant}\n aria-roledescription=\"carousel\"\n aria-label={label}\n >\n {children}\n </section>\n </CarouselContext>\n );\n}\n\nexport function CarouselTrack({ children, style, ref, onScroll, ...props }: CarouselTrackProps) {\n const { setItemCount, itemsPerPage, currentPage, variant, goToPage } = useCarousel();\n const items = Children.toArray(children);\n const count = items.length;\n const scrollRef = useRef<HTMLDivElement>(null);\n // True while an internal scrollTo animation runs, so the native scroll events it emits do not\n // feed back into goToPage and fight the animation. Cleared once the target page is reached.\n const programmaticScroll = useRef(false);\n\n // Scroll mode needs the internal scrollRef to drive scrollTo, but must still honor a\n // consumer-forwarded ref (the slide branch gets it for free through the element).\n const mergedScrollRef = useCallback(\n (node: HTMLDivElement | null) => {\n scrollRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n\n useEffect(() => {\n setItemCount(count);\n }, [count, setItemCount]);\n\n // In scroll mode the track is the native scroll container; move it to the current page unless it\n // is already there (e.g. the user just scrolled), so a programmatic scroll never fights the user.\n useEffect(() => {\n if (variant !== 'scroll') return;\n const el = scrollRef.current;\n if (!el || typeof el.scrollTo !== 'function') return;\n if (el.clientWidth > 0 && Math.round(el.scrollLeft / el.clientWidth) === currentPage) return;\n programmaticScroll.current = true;\n el.scrollTo({ left: currentPage * el.clientWidth, behavior: 'smooth' });\n }, [variant, currentPage]);\n\n // Sync a user scroll back into the paging state so bullets and Previous/Next stay accurate.\n function handleScroll(event: React.UIEvent<HTMLDivElement>) {\n onScroll?.(event);\n const { clientWidth, scrollLeft } = event.currentTarget;\n if (clientWidth <= 0) return;\n const page = Math.round(scrollLeft / clientWidth);\n if (programmaticScroll.current) {\n if (page === currentPage) programmaticScroll.current = false;\n return;\n }\n if (page !== currentPage) goToPage(page);\n }\n\n const itemStyle: React.CSSProperties = { flex: `0 0 ${100 / itemsPerPage}%`, boxSizing: 'border-box' };\n\n const renderedItems = items.map((child, index) => (\n <div\n key={index}\n data-fs-carousel-item=\"\"\n style={variant === 'scroll' ? { ...itemStyle, scrollSnapAlign: 'start' } : itemStyle}\n >\n {child}\n </div>\n ));\n\n if (variant === 'scroll') {\n return (\n <div\n {...props}\n ref={mergedScrollRef}\n onScroll={handleScroll}\n data-fs-carousel-track=\"\"\n style={{ display: 'flex', overflowX: 'auto', scrollSnapType: 'x mandatory', ...style }}\n >\n {renderedItems}\n </div>\n );\n }\n\n return (\n <div {...props} ref={ref} data-fs-carousel-track=\"\" style={{ overflow: 'hidden', ...style }}>\n <div\n data-fs-carousel-viewport=\"\"\n style={{ display: 'flex', transform: `translateX(-${currentPage * 100}%)`, transition: 'transform 300ms ease' }}\n >\n {renderedItems}\n </div>\n </div>\n );\n}\n\nexport function CarouselPrevious({ children, onClick, ...props }: CarouselPreviousProps) {\n const { previous, canGoPrevious } = useCarousel();\n return (\n <button\n type=\"button\"\n disabled={!canGoPrevious}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) previous();\n }}\n aria-label=\"Previous\"\n data-fs-carousel-previous=\"\"\n {...props}\n >\n {children}\n </button>\n );\n}\n\nexport function CarouselNext({ children, onClick, ...props }: CarouselNextProps) {\n const { next, canGoNext } = useCarousel();\n return (\n <button\n type=\"button\"\n disabled={!canGoNext}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) next();\n }}\n aria-label=\"Next\"\n data-fs-carousel-next=\"\"\n {...props}\n >\n {children}\n </button>\n );\n}\n\nexport function CarouselBullets({\n ariaLabel = 'Choose page',\n bulletLabel = 'Go to page {page}',\n hideWhenSingle = true,\n ...props\n}: CarouselBulletsProps) {\n const { totalPages, currentPage, goToPage } = useCarousel();\n\n if (hideWhenSingle && totalPages <= 1) return null;\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLButtonElement>, page: number) {\n let target = page;\n switch (event.key) {\n case 'ArrowRight':\n target = Math.min(page + 1, totalPages - 1);\n break;\n case 'ArrowLeft':\n target = Math.max(page - 1, 0);\n break;\n case 'Home':\n target = 0;\n break;\n case 'End':\n target = totalPages - 1;\n break;\n default:\n return;\n }\n event.preventDefault();\n goToPage(target);\n const bullets = event.currentTarget.parentElement?.querySelectorAll<HTMLButtonElement>('[data-fs-carousel-bullet]');\n bullets?.[target]?.focus();\n }\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: a labelled group of pagination buttons is not a <fieldset>\n <div role=\"group\" aria-label={ariaLabel} data-fs-carousel-bullets=\"\" {...props}>\n {Array.from({ length: totalPages }, (_, page) => {\n const isActive = page === currentPage;\n return (\n <button\n key={page}\n type=\"button\"\n aria-label={bulletLabel.replace('{page}', String(page + 1))}\n aria-current={isActive}\n data-fs-carousel-bullet=\"\"\n data-fs-carousel-bullet-selected={String(isActive)}\n onClick={() => goToPage(page)}\n onKeyDown={(event) => handleKeyDown(event, page)}\n />\n );\n })}\n </div>\n );\n}\n\nexport const CarouselRootDefinition = defineComponent<CarouselRootProps>({\n name: 'CarouselRoot',\n importPath: '@vtex/faststore/components',\n component: CarouselRoot,\n editor: { label: 'Carousel Root', category: 'layout' },\n schema: {\n infiniteMode: { type: 'boolean', default: false, label: 'Infinite Mode' },\n variant: { type: ['slide', 'scroll'] as const, default: 'slide', label: 'Variant' },\n itemsPerPage: { type: 'number', default: 1, label: 'Items Per Page' },\n defaultPage: { type: 'number', default: 0, label: 'Default Page' },\n label: { type: 'string', default: 'Carousel', label: 'Aria Label' },\n },\n guideline:\n 'Root of the carousel. Provides paging state to all parts. Compose as: CarouselRoot > (CarouselTrack > [item children] + CarouselPrevious + CarouselNext + CarouselBullets). Set infiniteMode=true to loop seamlessly (arrows never disable); variant=\"scroll\" for native overflow, \"slide\" for transform transitions. itemsPerPage sets how many children are visible per page. Holds no product or media data — nest any children in CarouselTrack.',\n});\n\nexport const CarouselTrackDefinition = defineComponent<CarouselTrackProps>({\n name: 'CarouselTrack',\n importPath: '@vtex/faststore/components',\n component: CarouselTrack,\n editor: { label: 'Carousel Track', category: 'layout' },\n schema: {},\n guideline:\n 'Lays out the carousel items as a single track and reports the child count to CarouselRoot. Wraps each child in an item slot sized to 100/itemsPerPage percent. In slide variant it translates by page; in scroll variant it is the native scroll-snap container. Place the iterated children (e.g. product cards) directly inside. Must be inside CarouselRoot.',\n});\n\nexport const CarouselPreviousDefinition = defineComponent<CarouselPreviousProps>({\n name: 'CarouselPrevious',\n importPath: '@vtex/faststore/components',\n component: CarouselPrevious,\n editor: { label: 'Carousel Previous', category: 'action' },\n schema: {},\n guideline:\n 'Moves the track one page backward. Disabled on the first page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the last page). Accepts any children (Icon, text). Must be inside CarouselRoot.',\n});\n\nexport const CarouselNextDefinition = defineComponent<CarouselNextProps>({\n name: 'CarouselNext',\n importPath: '@vtex/faststore/components',\n component: CarouselNext,\n editor: { label: 'Carousel Next', category: 'action' },\n schema: {},\n guideline:\n 'Moves the track one page forward. Disabled on the last page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the first page). Accepts any children (Icon, text). Must be inside CarouselRoot.',\n});\n\nexport const CarouselBulletsDefinition = defineComponent<CarouselBulletsProps>({\n name: 'CarouselBullets',\n importPath: '@vtex/faststore/components',\n component: CarouselBullets,\n editor: { label: 'Carousel Bullets', category: 'action' },\n schema: {\n ariaLabel: { type: 'string', default: 'Choose page', label: 'Aria Label' },\n bulletLabel: { type: 'string', default: 'Go to page {page}', label: 'Bullet Label Template' },\n hideWhenSingle: { type: 'boolean', default: true, label: 'Hide when single page' },\n },\n guideline:\n 'Renders one bullet button per page and marks the active page. Supports ArrowLeft/ArrowRight/Home/End keyboard navigation. Returns null when there is a single page unless hideWhenSingle={false}. Use {page} in bulletLabel for the 1-based page number. Must be inside CarouselRoot.',\n});\n\nexport const Carousel = {\n Root: CarouselRoot,\n Track: CarouselTrack,\n Previous: CarouselPrevious,\n Next: CarouselNext,\n Bullets: CarouselBullets,\n};\n"],"mappings":";;;;;;AA2DA,MAAM,kBAAkB,cAA2C,IAAI;AAEvE,SAAgB,cAAoC;CAClD,MAAM,MAAM,WAAW,eAAe;CACtC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,uDAAuD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;GAAE,MAAM;GAAU,SAAS;GAAG,OAAO;EAAiB;EACpE,aAAa;GAAE,MAAM;GAAU,SAAS;GAAG,OAAO;EAAe;EACjE,OAAO;GAAE,MAAM;GAAU,SAAS;GAAY,OAAO;EAAa;CACpE;CACA,WACE;AACJ,CAAC;AAED,MAAa,0BAA0B,gBAAoC;CACzE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAkB,UAAU;CAAS;CACtD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,6BAA6B,gBAAuC;CAC/E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAqB,UAAU;CAAS;CACzD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,yBAAyB,gBAAmC;CACvE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAiB,UAAU;CAAS;CACrD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,4BAA4B,gBAAsC;CAC7E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAoB,UAAU;CAAS;CACxD,QAAQ;EACN,WAAW;GAAE,MAAM;GAAU,SAAS;GAAe,OAAO;EAAa;EACzE,aAAa;GAAE,MAAM;GAAU,SAAS;GAAqB,OAAO;EAAwB;EAC5F,gBAAgB;GAAE,MAAM;GAAW,SAAS;GAAM,OAAO;EAAwB;CACnF;CACA,WACE;AACJ,CAAC;AAED,MAAa,WAAW;CACtB,MAAM;CACN,OAAO;CACP,UAAU;CACV,MAAM;CACN,SAAS;AACX"}
|
|
1
|
+
{"version":3,"file":"carousel.js","names":[],"sources":["../../../src/particles/carousel/carousel.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport {\n Children,\n type ComponentPropsWithRef,\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\n\nexport const CarouselRootContent = defineContentType({\n id: 'carousel-root',\n title: 'Carousel Root',\n description: 'Accessible name of the carousel region.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: { type: 'string', title: 'Accessible label', format: 'icu-message', messageSource: 'Carousel' },\n },\n },\n});\n\nexport const CarouselPreviousContent = defineContentType({\n id: 'carousel-previous',\n title: 'Carousel Previous',\n description: 'Accessible name of the previous-page control.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: { type: 'string', title: 'Accessible label', format: 'icu-message', messageSource: 'Previous' },\n },\n },\n});\n\nexport const CarouselNextContent = defineContentType({\n id: 'carousel-next',\n title: 'Carousel Next',\n description: 'Accessible name of the next-page control.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: { type: 'string', title: 'Accessible label', format: 'icu-message', messageSource: 'Next' },\n },\n },\n});\n\nexport const CarouselBulletsContent = defineContentType({\n id: 'carousel-bullets',\n title: 'Carousel Bullets',\n description: 'Accessible names of the page bullets and of their group.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n ariaLabel: {\n type: 'string',\n title: 'Group accessible label',\n format: 'icu-message',\n messageSource: 'Choose page',\n },\n bulletLabel: {\n type: 'string',\n title: 'Bullet accessible label',\n description: 'The page argument is the 1-based page number.',\n format: 'icu-message',\n messageSource: 'Go to page {page}',\n messageArguments: { type: 'object', properties: { page: { type: 'integer' } } },\n messageExample: { page: 2 },\n },\n },\n },\n});\n\nexport type CarouselVariant = 'slide' | 'scroll';\n\nexport type CarouselContextValue = {\n currentPage: number;\n itemCount: number;\n itemsPerPage: number;\n totalPages: number;\n variant: CarouselVariant;\n infiniteMode: boolean;\n goToPage: (page: number) => void;\n next: () => void;\n previous: () => void;\n canGoNext: boolean;\n canGoPrevious: boolean;\n setItemCount: (count: number) => void;\n};\n\nexport type CarouselRootProps = ComponentPropsWithRef<'section'> &\n MessageLocaleProp & {\n infiniteMode?: boolean;\n variant?: CarouselVariant;\n itemsPerPage?: number;\n defaultPage?: number;\n $content?: ContentValue<typeof CarouselRootContent>;\n };\n\nexport type CarouselTrackProps = ComponentPropsWithRef<'div'> & {\n children?: ReactNode;\n};\n\nexport type CarouselPreviousProps = ComponentPropsWithRef<'button'> &\n MessageLocaleProp & {\n children?: ReactNode;\n $content?: ContentValue<typeof CarouselPreviousContent>;\n };\n\nexport type CarouselNextProps = ComponentPropsWithRef<'button'> &\n MessageLocaleProp & {\n children?: ReactNode;\n $content?: ContentValue<typeof CarouselNextContent>;\n };\n\nexport type CarouselBulletsProps = ComponentPropsWithRef<'div'> &\n MessageLocaleProp & {\n hideWhenSingle?: boolean;\n $content?: ContentValue<typeof CarouselBulletsContent>;\n };\n\nconst CarouselContext = createContext<CarouselContextValue | null>(null);\n\nexport function useCarousel(): CarouselContextValue {\n const ctx = useContext(CarouselContext);\n if (!ctx) throw new Error('Carousel components must be used inside CarouselRoot.');\n return ctx;\n}\n\nexport function CarouselRoot({\n infiniteMode = false,\n variant = 'slide',\n itemsPerPage = 1,\n defaultPage = 0,\n $locale,\n $content,\n children,\n ...props\n}: CarouselRootProps) {\n const messages = useMessageFormatter(CarouselRootContent, $content);\n const [currentPage, setCurrentPage] = useState(defaultPage);\n const [itemCount, setItemCountState] = useState(0);\n\n const perPage = Math.max(1, itemsPerPage);\n const totalPages = Math.max(1, Math.ceil(itemCount / perPage));\n\n const setItemCount = useCallback((count: number) => {\n setItemCountState((prev) => (prev === count ? prev : count));\n }, []);\n\n // Keep the current page in range when the number of pages shrinks.\n useEffect(() => {\n if (itemCount === 0) return;\n setCurrentPage((page) => Math.min(page, totalPages - 1));\n }, [itemCount, totalPages]);\n\n const goToPage = useCallback(\n (page: number) => {\n setCurrentPage(Math.max(0, Math.min(page, totalPages - 1)));\n },\n [totalPages],\n );\n\n const next = useCallback(() => {\n setCurrentPage((page) => (infiniteMode ? (page + 1) % totalPages : Math.min(page + 1, totalPages - 1)));\n }, [infiniteMode, totalPages]);\n\n const previous = useCallback(() => {\n setCurrentPage((page) => (infiniteMode ? (page - 1 + totalPages) % totalPages : Math.max(page - 1, 0)));\n }, [infiniteMode, totalPages]);\n\n const canGoNext = infiniteMode ? totalPages > 1 : currentPage < totalPages - 1;\n const canGoPrevious = infiniteMode ? totalPages > 1 : currentPage > 0;\n\n const ctx = useMemo<CarouselContextValue>(\n () => ({\n currentPage,\n itemCount,\n itemsPerPage: perPage,\n totalPages,\n variant,\n infiniteMode,\n goToPage,\n next,\n previous,\n canGoNext,\n canGoPrevious,\n setItemCount,\n }),\n [\n currentPage,\n itemCount,\n perPage,\n totalPages,\n variant,\n infiniteMode,\n goToPage,\n next,\n previous,\n canGoNext,\n canGoPrevious,\n setItemCount,\n ],\n );\n\n return (\n <CarouselContext value={ctx}>\n <section\n {...props}\n data-fs-carousel=\"\"\n data-fs-carousel-variant={variant}\n aria-roledescription=\"carousel\"\n aria-label={messages.format('label')}\n >\n {children}\n </section>\n </CarouselContext>\n );\n}\n\nexport function CarouselTrack({ children, style, ref, onScroll, ...props }: CarouselTrackProps) {\n const { setItemCount, itemsPerPage, currentPage, variant, goToPage } = useCarousel();\n const items = Children.toArray(children);\n const count = items.length;\n const scrollRef = useRef<HTMLDivElement>(null);\n // True while an internal scrollTo animation runs, so the native scroll events it emits do not\n // feed back into goToPage and fight the animation. Cleared once the target page is reached.\n const programmaticScroll = useRef(false);\n\n // Scroll mode needs the internal scrollRef to drive scrollTo, but must still honor a\n // consumer-forwarded ref (the slide branch gets it for free through the element).\n const mergedScrollRef = useCallback(\n (node: HTMLDivElement | null) => {\n scrollRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n\n useEffect(() => {\n setItemCount(count);\n }, [count, setItemCount]);\n\n // In scroll mode the track is the native scroll container; move it to the current page unless it\n // is already there (e.g. the user just scrolled), so a programmatic scroll never fights the user.\n useEffect(() => {\n if (variant !== 'scroll') return;\n const el = scrollRef.current;\n if (!el || typeof el.scrollTo !== 'function') return;\n if (el.clientWidth > 0 && Math.round(el.scrollLeft / el.clientWidth) === currentPage) return;\n programmaticScroll.current = true;\n el.scrollTo({ left: currentPage * el.clientWidth, behavior: 'smooth' });\n }, [variant, currentPage]);\n\n // Sync a user scroll back into the paging state so bullets and Previous/Next stay accurate.\n function handleScroll(event: React.UIEvent<HTMLDivElement>) {\n onScroll?.(event);\n const { clientWidth, scrollLeft } = event.currentTarget;\n if (clientWidth <= 0) return;\n const page = Math.round(scrollLeft / clientWidth);\n if (programmaticScroll.current) {\n if (page === currentPage) programmaticScroll.current = false;\n return;\n }\n if (page !== currentPage) goToPage(page);\n }\n\n const itemStyle: React.CSSProperties = { flex: `0 0 ${100 / itemsPerPage}%`, boxSizing: 'border-box' };\n\n const renderedItems = items.map((child, index) => (\n <div\n key={index}\n data-fs-carousel-item=\"\"\n style={variant === 'scroll' ? { ...itemStyle, scrollSnapAlign: 'start' } : itemStyle}\n >\n {child}\n </div>\n ));\n\n if (variant === 'scroll') {\n return (\n <div\n {...props}\n ref={mergedScrollRef}\n onScroll={handleScroll}\n data-fs-carousel-track=\"\"\n style={{ display: 'flex', overflowX: 'auto', scrollSnapType: 'x mandatory', ...style }}\n >\n {renderedItems}\n </div>\n );\n }\n\n return (\n <div {...props} ref={ref} data-fs-carousel-track=\"\" style={{ overflow: 'hidden', ...style }}>\n <div\n data-fs-carousel-viewport=\"\"\n style={{ display: 'flex', transform: `translateX(-${currentPage * 100}%)`, transition: 'transform 300ms ease' }}\n >\n {renderedItems}\n </div>\n </div>\n );\n}\n\nexport function CarouselPrevious({ $locale, $content, children, onClick, ...props }: CarouselPreviousProps) {\n const { previous, canGoPrevious } = useCarousel();\n const messages = useMessageFormatter(CarouselPreviousContent, $content);\n return (\n <button\n type=\"button\"\n disabled={!canGoPrevious}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) previous();\n }}\n aria-label={messages.format('label')}\n data-fs-carousel-previous=\"\"\n {...props}\n >\n {children}\n </button>\n );\n}\n\nexport function CarouselNext({ $locale, $content, children, onClick, ...props }: CarouselNextProps) {\n const { next, canGoNext } = useCarousel();\n const messages = useMessageFormatter(CarouselNextContent, $content);\n return (\n <button\n type=\"button\"\n disabled={!canGoNext}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) next();\n }}\n aria-label={messages.format('label')}\n data-fs-carousel-next=\"\"\n {...props}\n >\n {children}\n </button>\n );\n}\n\nexport function CarouselBullets({ $locale, $content, hideWhenSingle = true, ...props }: CarouselBulletsProps) {\n const { totalPages, currentPage, goToPage } = useCarousel();\n const messages = useMessageFormatter(CarouselBulletsContent, $content);\n\n if (hideWhenSingle && totalPages <= 1) return null;\n const ariaLabel = messages.format('ariaLabel');\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLButtonElement>, page: number) {\n let target = page;\n switch (event.key) {\n case 'ArrowRight':\n target = Math.min(page + 1, totalPages - 1);\n break;\n case 'ArrowLeft':\n target = Math.max(page - 1, 0);\n break;\n case 'Home':\n target = 0;\n break;\n case 'End':\n target = totalPages - 1;\n break;\n default:\n return;\n }\n event.preventDefault();\n goToPage(target);\n const bullets = event.currentTarget.parentElement?.querySelectorAll<HTMLButtonElement>('[data-fs-carousel-bullet]');\n bullets?.[target]?.focus();\n }\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: a labelled group of pagination buttons is not a <fieldset>\n <div role=\"group\" aria-label={ariaLabel} data-fs-carousel-bullets=\"\" {...props}>\n {Array.from({ length: totalPages }, (_, page) => {\n const isActive = page === currentPage;\n return (\n <button\n key={page}\n type=\"button\"\n aria-label={messages.format('bulletLabel', { page: page + 1 })}\n aria-current={isActive}\n data-fs-carousel-bullet=\"\"\n data-fs-carousel-bullet-selected={String(isActive)}\n onClick={() => goToPage(page)}\n onKeyDown={(event) => handleKeyDown(event, page)}\n />\n );\n })}\n </div>\n );\n}\n\nexport const CarouselRootDefinition = defineComponent<CarouselRootProps>({\n name: 'CarouselRoot',\n importPath: '@vtex/faststore/components',\n component: CarouselRoot,\n content: CarouselRootContent,\n editor: { label: 'Carousel Root', category: 'layout' },\n schema: {\n infiniteMode: { type: 'boolean', default: false, label: 'Infinite Mode' },\n variant: { type: ['slide', 'scroll'] as const, default: 'slide', label: 'Variant' },\n itemsPerPage: { type: 'number', default: 1, label: 'Items Per Page' },\n defaultPage: { type: 'number', default: 0, label: 'Default Page' },\n },\n guideline:\n 'Root of the carousel. Provides paging state to all parts. Compose as: CarouselRoot > (CarouselTrack > [item children] + CarouselPrevious + CarouselNext + CarouselBullets). Set infiniteMode=true to loop seamlessly (arrows never disable); variant=\"scroll\" for native overflow, \"slide\" for transform transitions. itemsPerPage sets how many children are visible per page. Its accessible name comes from the $content field label. Holds no product or media data — nest any children in CarouselTrack.',\n});\n\nexport const CarouselTrackDefinition = defineComponent<CarouselTrackProps>({\n name: 'CarouselTrack',\n importPath: '@vtex/faststore/components',\n component: CarouselTrack,\n editor: { label: 'Carousel Track', category: 'layout' },\n schema: {},\n guideline:\n 'Lays out the carousel items as a single track and reports the child count to CarouselRoot. Wraps each child in an item slot sized to 100/itemsPerPage percent. In slide variant it translates by page; in scroll variant it is the native scroll-snap container. Place the iterated children (e.g. product cards) directly inside. Must be inside CarouselRoot.',\n});\n\nexport const CarouselPreviousDefinition = defineComponent<CarouselPreviousProps>({\n name: 'CarouselPrevious',\n importPath: '@vtex/faststore/components',\n component: CarouselPrevious,\n content: CarouselPreviousContent,\n editor: { label: 'Carousel Previous', category: 'action' },\n schema: {},\n guideline:\n 'Moves the track one page backward. Disabled on the first page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the last page). Accepts any children (Icon, text); its accessible name comes from the $content field label. Must be inside CarouselRoot.',\n});\n\nexport const CarouselNextDefinition = defineComponent<CarouselNextProps>({\n name: 'CarouselNext',\n importPath: '@vtex/faststore/components',\n component: CarouselNext,\n content: CarouselNextContent,\n editor: { label: 'Carousel Next', category: 'action' },\n schema: {},\n guideline:\n 'Moves the track one page forward. Disabled on the last page when infiniteMode is off; never disabled when infiniteMode is on (wraps to the first page). Accepts any children (Icon, text); its accessible name comes from the $content field label. Must be inside CarouselRoot.',\n});\n\nexport const CarouselBulletsDefinition = defineComponent<CarouselBulletsProps>({\n name: 'CarouselBullets',\n importPath: '@vtex/faststore/components',\n component: CarouselBullets,\n content: CarouselBulletsContent,\n editor: { label: 'Carousel Bullets', category: 'action' },\n schema: {\n hideWhenSingle: { type: 'boolean', default: true, label: 'Hide when single page' },\n },\n guideline:\n 'Renders one bullet button per page and marks the active page. Supports ArrowLeft/ArrowRight/Home/End keyboard navigation. Returns null when there is a single page unless hideWhenSingle={false}. The group accessible name is the $content field ariaLabel; each bullet takes bulletLabel, whose page argument is the 1-based page number. Must be inside CarouselRoot.',\n});\n\nexport const Carousel = {\n Root: CarouselRoot,\n Track: CarouselTrack,\n Previous: CarouselPrevious,\n Next: CarouselNext,\n Bullets: CarouselBullets,\n};\n"],"mappings":";;;;;;;;AAiBA,MAAa,sBAAsB,kBAAkB;CACnD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY,EACV,OAAO;GAAE,MAAM;GAAU,OAAO;GAAoB,QAAQ;GAAe,eAAe;EAAW,EACvG;CACF;AACF,CAAC;AAED,MAAa,0BAA0B,kBAAkB;CACvD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY,EACV,OAAO;GAAE,MAAM;GAAU,OAAO;GAAoB,QAAQ;GAAe,eAAe;EAAW,EACvG;CACF;AACF,CAAC;AAED,MAAa,sBAAsB,kBAAkB;CACnD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY,EACV,OAAO;GAAE,MAAM;GAAU,OAAO;GAAoB,QAAQ;GAAe,eAAe;EAAO,EACnG;CACF;AACF,CAAC;A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C;AAED,MAAa,yBAAyB,gBAAmC;CACvE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,SAAS;CACT,QAAQ;EAAE,OAAO;EAAiB,UAAU;CAAS;CACrD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,4BAA4B,gBAAsC;CAC7E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,SAAS;CACT,QAAQ;EAAE,OAAO;EAAoB,UAAU;CAAS;CACxD,QAAQ,EACN,gBAAgB;EAAE,MAAM;EAAW,SAAS;EAAM,OAAO;CAAwB,EACnF;CACA,WACE;AACJ,CAAC;AAED,MAAa,WAAW;CACtB,MAAM;CACN,OAAO;CACP,UAAU;CACV,MAAM;CACN,SAAS;AACX"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
3
|
import "../../core/dist/index.js";
|
|
4
|
-
import { useIntl } from "../../sdk/i18n/client.js";
|
|
5
4
|
import { Button } from "../button/button.js";
|
|
6
5
|
import { useEffect, useRef, useState } from "react";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -21,33 +20,24 @@ const CopyTextDefinition = defineComponent({
|
|
|
21
20
|
schema: {
|
|
22
21
|
accessibleName: {
|
|
23
22
|
type: "string",
|
|
24
|
-
default: "Copy",
|
|
25
23
|
label: "Accessible name"
|
|
26
24
|
},
|
|
27
25
|
successMessage: {
|
|
28
26
|
type: "string",
|
|
29
|
-
default: "Copied",
|
|
30
27
|
label: "Success message"
|
|
31
28
|
},
|
|
32
29
|
failureMessage: {
|
|
33
30
|
type: "string",
|
|
34
|
-
default: "Could not copy",
|
|
35
31
|
label: "Failure message"
|
|
36
32
|
},
|
|
37
33
|
dismissLabel: {
|
|
38
34
|
type: "string",
|
|
39
|
-
default: "Dismiss",
|
|
40
35
|
label: "Dismiss label"
|
|
41
36
|
}
|
|
42
37
|
},
|
|
43
|
-
guideline: "Copies the text it is given and confirms the result inline. Pass the identifier as text
|
|
38
|
+
guideline: "Copies the text it is given and confirms the result inline. Pass the identifier as text, the visible icon or label as children, and the formatted copy as props; they have no default, so the owner formats every one. Do not pass surrounding heading text."
|
|
44
39
|
});
|
|
45
40
|
function CopyText({ text, accessibleName, successMessage, failureMessage, dismissLabel, children, className, ref }) {
|
|
46
|
-
const intl = useIntl();
|
|
47
|
-
const name = accessibleName ?? intl.formatMessage({ id: "fs/order.copy.action" });
|
|
48
|
-
const success = successMessage ?? intl.formatMessage({ id: "fs/order.copy.copied" });
|
|
49
|
-
const failure = failureMessage ?? intl.formatMessage({ id: "fs/order.copy.failure" });
|
|
50
|
-
const dismissText = dismissLabel ?? intl.formatMessage({ id: "fs/order.copy.dismiss" });
|
|
51
41
|
const [outcome, setOutcome] = useState("idle");
|
|
52
42
|
const actionRef = useRef(null);
|
|
53
43
|
const timerRef = useRef(null);
|
|
@@ -107,7 +97,7 @@ function CopyText({ text, accessibleName, successMessage, failureMessage, dismis
|
|
|
107
97
|
setOutcome("idle");
|
|
108
98
|
actionRef.current?.focus();
|
|
109
99
|
}
|
|
110
|
-
const message = outcome === "success" ?
|
|
100
|
+
const message = outcome === "success" ? successMessage : failureMessage;
|
|
111
101
|
return /* @__PURE__ */ jsxs("span", {
|
|
112
102
|
ref,
|
|
113
103
|
className,
|
|
@@ -116,7 +106,7 @@ function CopyText({ text, accessibleName, successMessage, failureMessage, dismis
|
|
|
116
106
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
117
107
|
ref: actionRef,
|
|
118
108
|
type: "button",
|
|
119
|
-
"aria-label":
|
|
109
|
+
"aria-label": accessibleName,
|
|
120
110
|
"data-fs-copy-text-action": "",
|
|
121
111
|
disabled: isBlank(text) || outcome === "pending",
|
|
122
112
|
onClick: () => {
|
|
@@ -127,9 +117,9 @@ function CopyText({ text, accessibleName, successMessage, failureMessage, dismis
|
|
|
127
117
|
"data-fs-copy-text-message": "",
|
|
128
118
|
children: [message, /* @__PURE__ */ jsx(Button, {
|
|
129
119
|
type: "button",
|
|
130
|
-
"aria-label":
|
|
120
|
+
"aria-label": dismissLabel,
|
|
131
121
|
onClick: dismiss,
|
|
132
|
-
children:
|
|
122
|
+
children: dismissLabel
|
|
133
123
|
})]
|
|
134
124
|
}) : null]
|
|
135
125
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-text.js","names":[],"sources":["../../../src/particles/copy-text/copy-text.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { type ReactNode, type Ref, useEffect, useRef, useState } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"copy-text.js","names":[],"sources":["../../../src/particles/copy-text/copy-text.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { type ReactNode, type Ref, useEffect, useRef, useState } from 'react';\nimport { Button } from '../button/button';\n\nconst CLEAR_AFTER_MS = 5000;\n\nexport type CopyTextOutcome = 'idle' | 'pending' | 'success' | 'failure';\n\nexport type CopyTextProps = Readonly<{\n text: string;\n accessibleName?: string;\n successMessage?: string;\n failureMessage?: string;\n dismissLabel?: string;\n children?: ReactNode;\n className?: string;\n ref?: Ref<HTMLSpanElement>;\n}>;\n\nfunction isBlank(text: string): boolean {\n return text.trim().length === 0;\n}\n\nexport const CopyTextDefinition = defineComponent<CopyTextProps>({\n name: 'CopyText',\n importPath: '@vtex/faststore/components',\n component: CopyText,\n editor: { label: 'Copy Text', category: 'action' },\n schema: {\n accessibleName: { type: 'string', label: 'Accessible name' },\n successMessage: { type: 'string', label: 'Success message' },\n failureMessage: { type: 'string', label: 'Failure message' },\n dismissLabel: { type: 'string', label: 'Dismiss label' },\n },\n guideline:\n 'Copies the text it is given and confirms the result inline. Pass the identifier as text, the visible icon or label as children, and the formatted copy as props; they have no default, so the owner formats every one. Do not pass surrounding heading text.',\n});\n\nexport function CopyText({\n text,\n accessibleName,\n successMessage,\n failureMessage,\n dismissLabel,\n children,\n className,\n ref,\n}: CopyTextProps) {\n const [outcome, setOutcome] = useState<CopyTextOutcome>('idle');\n const actionRef = useRef<HTMLButtonElement>(null);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const generation = useRef(0);\n const active = useRef(true);\n\n function clearTimer() {\n if (timerRef.current === null) return;\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n\n useEffect(() => {\n active.current = true;\n return () => {\n active.current = false;\n if (timerRef.current === null) return;\n clearTimeout(timerRef.current);\n timerRef.current = null;\n };\n }, []);\n\n function scheduleClear(token: number) {\n clearTimer();\n if (!active.current) return;\n timerRef.current = setTimeout(() => {\n if (!active.current || generation.current !== token) return;\n setOutcome('idle');\n }, CLEAR_AFTER_MS);\n }\n\n async function copy() {\n if (isBlank(text) || outcome === 'pending') return;\n const token = generation.current + 1;\n generation.current = token;\n clearTimer();\n setOutcome('pending');\n\n const write = navigator.clipboard?.writeText;\n if (typeof write !== 'function') {\n if (!active.current || generation.current !== token) return;\n setOutcome('failure');\n scheduleClear(token);\n return;\n }\n\n try {\n await write.call(navigator.clipboard, text);\n if (!active.current || generation.current !== token) return;\n setOutcome('success');\n } catch {\n if (!active.current || generation.current !== token) return;\n setOutcome('failure');\n }\n scheduleClear(token);\n }\n\n // The action is disabled while pending, and a disabled control ignores focus(). Focus moves back\n // once the outcome that re-enables it has committed.\n useEffect(() => {\n if (outcome === 'success' || outcome === 'failure') {\n actionRef.current?.focus();\n }\n }, [outcome]);\n\n function dismiss() {\n generation.current += 1;\n clearTimer();\n setOutcome('idle');\n actionRef.current?.focus();\n }\n\n const message = outcome === 'success' ? successMessage : failureMessage;\n\n return (\n <span ref={ref} className={className} data-fs-copy-text=\"\" data-fs-copy-text-outcome={outcome}>\n <Button\n ref={actionRef}\n type=\"button\"\n aria-label={accessibleName}\n data-fs-copy-text-action=\"\"\n disabled={isBlank(text) || outcome === 'pending'}\n onClick={() => {\n void copy();\n }}\n >\n {children}\n </Button>\n {outcome === 'success' || outcome === 'failure' ? (\n <output data-fs-copy-text-message=\"\">\n {message}\n <Button type=\"button\" aria-label={dismissLabel} onClick={dismiss}>\n {dismissLabel}\n </Button>\n </output>\n ) : null}\n </span>\n );\n}\n"],"mappings":";;;;;;;AAMA,MAAM,iBAAiB;AAevB,SAAS,QAAQ,MAAuB;CACtC,OAAO,KAAK,KAAK,CAAC,CAAC,WAAW;AAChC;AAEA,MAAa,qBAAqB,gBAA+B;CAC/D,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAa,UAAU;CAAS;CACjD,QAAQ;EACN,gBAAgB;GAAE,MAAM;GAAU,OAAO;EAAkB;EAC3D,gBAAgB;GAAE,MAAM;GAAU,OAAO;EAAkB;EAC3D,gBAAgB;GAAE,MAAM;GAAU,OAAO;EAAkB;EAC3D,cAAc;GAAE,MAAM;GAAU,OAAO;EAAgB;CACzD;CACA,WACE;AACJ,CAAC;AAED,SAAgB,SAAS,EACvB,MACA,gBACA,gBACA,gBACA,cACA,UACA,WACA,OACgB;CAChB,MAAM,CAAC,SAAS,cAAc,SAA0B,MAAM;CAC9D,MAAM,YAAY,OAA0B,IAAI;CAChD,MAAM,WAAW,OAA6C,IAAI;CAClE,MAAM,aAAa,OAAO,CAAC;CAC3B,MAAM,SAAS,OAAO,IAAI;CAE1B,SAAS,aAAa;EACpB,IAAI,SAAS,YAAY,MAAM;EAC/B,aAAa,SAAS,OAAO;EAC7B,SAAS,UAAU;CACrB;CAEA,gBAAgB;EACd,OAAO,UAAU;EACjB,aAAa;GACX,OAAO,UAAU;GACjB,IAAI,SAAS,YAAY,MAAM;GAC/B,aAAa,SAAS,OAAO;GAC7B,SAAS,UAAU;EACrB;CACF,GAAG,CAAC,CAAC;CAEL,SAAS,cAAc,OAAe;EACpC,WAAW;EACX,IAAI,CAAC,OAAO,SAAS;EACrB,SAAS,UAAU,iBAAiB;GAClC,IAAI,CAAC,OAAO,WAAW,WAAW,YAAY,OAAO;GACrD,WAAW,MAAM;EACnB,GAAG,cA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ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
2
|
import "../../core/dist/index.js";
|
|
3
|
-
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
import { ComponentProps, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
4
5
|
//#region src/particles/dialog/dialog.d.ts
|
|
5
6
|
export type DialogRootProps = {
|
|
6
7
|
open?: boolean;
|
|
@@ -12,9 +13,11 @@ export type DialogRootProps = {
|
|
|
12
13
|
children?: ReactNode;
|
|
13
14
|
};
|
|
14
15
|
export type DialogTriggerProps = ComponentPropsWithRef<'button'>;
|
|
15
|
-
export type DialogPortalProps = {
|
|
16
|
+
export type DialogPortalProps = Readonly<{
|
|
16
17
|
children?: ReactNode;
|
|
17
|
-
|
|
18
|
+
/** Parent element for the overlay. Omit it and the overlay renders on `document.body`. */
|
|
19
|
+
container?: ComponentProps<typeof Dialog.Portal>['container'];
|
|
20
|
+
}>;
|
|
18
21
|
export type DialogBackdropProps = ComponentPropsWithRef<'div'>;
|
|
19
22
|
export type DialogViewportProps = ComponentPropsWithRef<'div'>;
|
|
20
23
|
export type DialogPopupProps = ComponentPropsWithRef<'div'>;
|
|
@@ -23,7 +26,11 @@ export type DialogDescriptionProps = ComponentPropsWithRef<'p'>;
|
|
|
23
26
|
export type DialogCloseProps = ComponentPropsWithRef<'button'>;
|
|
24
27
|
export declare const DialogRootDefinition: ComponentDefinition<DialogRootProps>;
|
|
25
28
|
export declare const DialogTriggerDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
|
|
26
|
-
export declare const DialogPortalDefinition: ComponentDefinition<
|
|
29
|
+
export declare const DialogPortalDefinition: ComponentDefinition<Readonly<{
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
/** Parent element for the overlay. Omit it and the overlay renders on `document.body`. */
|
|
32
|
+
container?: ComponentProps<typeof Dialog.Portal>["container"];
|
|
33
|
+
}>>;
|
|
27
34
|
export declare const DialogBackdropDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
28
35
|
export declare const DialogViewportDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
29
36
|
export declare const DialogPopupDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
@@ -32,14 +39,14 @@ export declare const DialogDescriptionDefinition: ComponentDefinition<import("re
|
|
|
32
39
|
export declare const DialogCloseDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
|
|
33
40
|
export declare function DialogRoot({ open, defaultOpen, modal, onOpenChange, children }: DialogRootProps): import("react/jsx-runtime").JSX.Element;
|
|
34
41
|
export declare function DialogTrigger({ className, children, ...props }: DialogTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
-
export declare function DialogPortal({ children }: DialogPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function DialogPortal({ children, container }: DialogPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
36
43
|
export declare function DialogBackdrop({ className, children, ...props }: DialogBackdropProps): import("react/jsx-runtime").JSX.Element;
|
|
37
44
|
export declare function DialogViewport({ className, children, ...props }: DialogViewportProps): import("react/jsx-runtime").JSX.Element;
|
|
38
45
|
export declare function DialogPopup({ className, children, ...props }: DialogPopupProps): import("react/jsx-runtime").JSX.Element;
|
|
39
46
|
export declare function DialogTitle({ className, children, ...props }: DialogTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
40
47
|
export declare function DialogDescription({ className, children, ...props }: DialogDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
41
48
|
export declare function DialogClose({ className, children, ...props }: DialogCloseProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
-
|
|
49
|
+
declare const Dialog$1: {
|
|
43
50
|
Root: typeof DialogRoot;
|
|
44
51
|
Trigger: typeof DialogTrigger;
|
|
45
52
|
Portal: typeof DialogPortal;
|
|
@@ -51,4 +58,5 @@ export declare const Dialog: {
|
|
|
51
58
|
Close: typeof DialogClose;
|
|
52
59
|
};
|
|
53
60
|
//#endregion
|
|
61
|
+
export { Dialog$1 as Dialog };
|
|
54
62
|
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -39,7 +39,7 @@ const DialogPortalDefinition = defineComponent({
|
|
|
39
39
|
category: "layout"
|
|
40
40
|
},
|
|
41
41
|
schema: {},
|
|
42
|
-
guideline: "Renders its children outside the DOM tree (into document.body). Place DialogBackdrop and DialogViewport as direct children, in that order."
|
|
42
|
+
guideline: "Renders its children outside the DOM tree (into document.body, or into container when a parent swatch must reach the overlay). Place DialogBackdrop and DialogViewport as direct children, in that order."
|
|
43
43
|
});
|
|
44
44
|
const DialogBackdropDefinition = defineComponent({
|
|
45
45
|
name: "DialogBackdrop",
|
|
@@ -124,8 +124,11 @@ function DialogTrigger({ className, children, ...props }) {
|
|
|
124
124
|
children
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
function DialogPortal({ children }) {
|
|
128
|
-
return /* @__PURE__ */ jsx(Dialog.Portal, {
|
|
127
|
+
function DialogPortal({ children, container }) {
|
|
128
|
+
return /* @__PURE__ */ jsx(Dialog.Portal, {
|
|
129
|
+
container,
|
|
130
|
+
children
|
|
131
|
+
});
|
|
129
132
|
}
|
|
130
133
|
function DialogBackdrop({ className, children, ...props }) {
|
|
131
134
|
return /* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":["BaseDialog","Dialog"],"sources":["../../../src/particles/dialog/dialog.tsx"],"sourcesContent":["'use client';\nimport { Dialog as BaseDialog } from '@base-ui/react/dialog';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\n\nexport type DialogRootProps = {\n open?: boolean;\n defaultOpen?: boolean;\n modal?: boolean;\n onOpenChange?: (open: boolean, eventDetails: { isCanceled: boolean }) => void;\n children?: ReactNode;\n};\n\nexport type DialogTriggerProps = ComponentPropsWithRef<'button'>;\n\nexport type DialogPortalProps = {\n children?: ReactNode;\n};\n\nexport type DialogBackdropProps = ComponentPropsWithRef<'div'>;\n\nexport type DialogViewportProps = ComponentPropsWithRef<'div'>;\n\nexport type DialogPopupProps = ComponentPropsWithRef<'div'>;\n\nexport type DialogTitleProps = ComponentPropsWithRef<'h2'>;\n\nexport type DialogDescriptionProps = ComponentPropsWithRef<'p'>;\n\nexport type DialogCloseProps = ComponentPropsWithRef<'button'>;\n\nexport const DialogRootDefinition = defineComponent<DialogRootProps>({\n name: 'DialogRoot',\n importPath: '@vtex/faststore/components',\n component: DialogRoot,\n editor: { label: 'Dialog Root', category: 'layout' },\n schema: {\n modal: { type: 'boolean', default: true, label: 'Modal' },\n },\n guideline:\n 'Root of a dialog overlay. Compose as: DialogRoot > (DialogTrigger + DialogPortal > (DialogBackdrop + DialogViewport > DialogPopup > (DialogTitle + content + DialogClose))). Set modal=false only when the dialog must coexist with page interactions.',\n});\n\nexport const DialogTriggerDefinition = defineComponent<DialogTriggerProps>({\n name: 'DialogTrigger',\n importPath: '@vtex/faststore/components',\n component: DialogTrigger,\n editor: { label: 'Dialog Trigger', category: 'action' },\n schema: {},\n guideline:\n 'Opens the dialog when clicked. Direct child of DialogRoot. Accepts any children (text, Icon). Base UI connects it to DialogRoot via context — no explicit wiring needed.',\n});\n\nexport const DialogPortalDefinition = defineComponent<DialogPortalProps>({\n name: 'DialogPortal',\n importPath: '@vtex/faststore/components',\n component: DialogPortal,\n editor: { label: 'Dialog Portal', category: 'layout' },\n schema: {},\n guideline:\n 'Renders its children outside the DOM tree (into document.body). Place DialogBackdrop and DialogViewport as direct children, in that order.',\n});\n\nexport const DialogBackdropDefinition = defineComponent<DialogBackdropProps>({\n name: 'DialogBackdrop',\n importPath: '@vtex/faststore/components',\n component: DialogBackdrop,\n editor: { label: 'Dialog Backdrop', category: 'layout' },\n schema: {},\n guideline:\n 'Semi-transparent overlay behind the popup. Direct child of DialogPortal, before DialogViewport. Clicking it closes the dialog unless disablePointerDismissal is set on DialogRoot.',\n});\n\nexport const DialogViewportDefinition = defineComponent<DialogViewportProps>({\n name: 'DialogViewport',\n importPath: '@vtex/faststore/components',\n component: DialogViewport,\n editor: { label: 'Dialog Viewport', category: 'layout' },\n schema: {},\n guideline:\n 'Positioning container for DialogPopup. Direct child of DialogPortal, after DialogBackdrop. Apply fixed positioning and centering here (e.g. fixed inset-0 flex items-center justify-center). Place DialogPopup inside.',\n});\n\nexport const DialogPopupDefinition = defineComponent<DialogPopupProps>({\n name: 'DialogPopup',\n importPath: '@vtex/faststore/components',\n component: DialogPopup,\n editor: { label: 'Dialog Popup', category: 'layout' },\n schema: {},\n guideline:\n 'The visible dialog panel, inside DialogViewport. Place DialogTitle (required), optional DialogDescription, your content, and DialogClose inside. Style with a background, padding, and shadow.',\n});\n\nexport const DialogTitleDefinition = defineComponent<DialogTitleProps>({\n name: 'DialogTitle',\n importPath: '@vtex/faststore/components',\n component: DialogTitle,\n editor: { label: 'Dialog Title', category: 'layout' },\n schema: {},\n guideline:\n 'Required heading inside DialogPopup — sets the accessible name of the dialog for screen readers. Use sr-only to hide it visually when a visual title already exists.',\n});\n\nexport const DialogDescriptionDefinition = defineComponent<DialogDescriptionProps>({\n name: 'DialogDescription',\n importPath: '@vtex/faststore/components',\n component: DialogDescription,\n editor: { label: 'Dialog Description', category: 'layout' },\n schema: {},\n guideline:\n 'Optional description inside DialogPopup, after DialogTitle. Provides additional context to screen readers. Omit if the dialog content is self-explanatory.',\n});\n\nexport const DialogCloseDefinition = defineComponent<DialogCloseProps>({\n name: 'DialogClose',\n importPath: '@vtex/faststore/components',\n component: DialogClose,\n editor: { label: 'Dialog Close', category: 'action' },\n schema: {},\n guideline:\n 'Closes the dialog when clicked. Place inside DialogPopup — can appear multiple times (e.g., close icon at top-right and a Cancel button at the bottom).',\n});\n\nexport function DialogRoot({ open, defaultOpen, modal = true, onOpenChange, children }: DialogRootProps) {\n return (\n <BaseDialog.Root open={open} defaultOpen={defaultOpen} modal={modal} onOpenChange={onOpenChange}>\n {children}\n </BaseDialog.Root>\n );\n}\n\nexport function DialogTrigger({ className, children, ...props }: DialogTriggerProps) {\n return (\n <BaseDialog.Trigger {...props} className={className} data-fs-dialog-trigger=\"\">\n {children}\n </BaseDialog.Trigger>\n );\n}\n\nexport function DialogPortal({ children }: DialogPortalProps) {\n return <BaseDialog.Portal>{children}</BaseDialog.Portal>;\n}\n\nexport function DialogBackdrop({ className, children, ...props }: DialogBackdropProps) {\n return (\n <BaseDialog.Backdrop {...props} className={className} data-fs-dialog-backdrop=\"\">\n {children}\n </BaseDialog.Backdrop>\n );\n}\n\nexport function DialogViewport({ className, children, ...props }: DialogViewportProps) {\n return (\n <div {...props} className={className} data-fs-dialog-viewport=\"\">\n {children}\n </div>\n );\n}\n\nexport function DialogPopup({ className, children, ...props }: DialogPopupProps) {\n return (\n <BaseDialog.Popup {...props} className={className} data-fs-dialog-popup=\"\">\n {children}\n </BaseDialog.Popup>\n );\n}\n\nexport function DialogTitle({ className, children, ...props }: DialogTitleProps) {\n return (\n <BaseDialog.Title {...props} className={className} data-fs-dialog-title=\"\">\n {children}\n </BaseDialog.Title>\n );\n}\n\nexport function DialogDescription({ className, children, ...props }: DialogDescriptionProps) {\n return (\n <BaseDialog.Description {...props} className={className} data-fs-dialog-description=\"\">\n {children}\n </BaseDialog.Description>\n );\n}\n\nexport function DialogClose({ className, children, ...props }: DialogCloseProps) {\n return (\n <BaseDialog.Close {...props} className={className} data-fs-dialog-close=\"\">\n {children}\n </BaseDialog.Close>\n );\n}\n\nexport const Dialog = {\n Root: DialogRoot,\n Trigger: DialogTrigger,\n Portal: DialogPortal,\n Backdrop: DialogBackdrop,\n Viewport: DialogVi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E,oBAACA,OAAW,aAAZ;EAAwB,GAAI;EAAkB;EAAW,8BAA2B;EACjF;CACqB,CAAA;AAE5B;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,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,OAAO;CACP,OAAO;CACP,aAAa;CACb,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"dialog.js","names":["BaseDialog","Dialog"],"sources":["../../../src/particles/dialog/dialog.tsx"],"sourcesContent":["'use client';\nimport { Dialog as BaseDialog } from '@base-ui/react/dialog';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentProps, ComponentPropsWithRef, ReactNode } from 'react';\n\nexport type DialogRootProps = {\n open?: boolean;\n defaultOpen?: boolean;\n modal?: boolean;\n onOpenChange?: (open: boolean, eventDetails: { isCanceled: boolean }) => void;\n children?: ReactNode;\n};\n\nexport type DialogTriggerProps = ComponentPropsWithRef<'button'>;\n\nexport type DialogPortalProps = Readonly<{\n children?: ReactNode;\n /** Parent element for the overlay. Omit it and the overlay renders on `document.body`. */\n container?: ComponentProps<typeof BaseDialog.Portal>['container'];\n}>;\n\nexport type DialogBackdropProps = ComponentPropsWithRef<'div'>;\n\nexport type DialogViewportProps = ComponentPropsWithRef<'div'>;\n\nexport type DialogPopupProps = ComponentPropsWithRef<'div'>;\n\nexport type DialogTitleProps = ComponentPropsWithRef<'h2'>;\n\nexport type DialogDescriptionProps = ComponentPropsWithRef<'p'>;\n\nexport type DialogCloseProps = ComponentPropsWithRef<'button'>;\n\nexport const DialogRootDefinition = defineComponent<DialogRootProps>({\n name: 'DialogRoot',\n importPath: '@vtex/faststore/components',\n component: DialogRoot,\n editor: { label: 'Dialog Root', category: 'layout' },\n schema: {\n modal: { type: 'boolean', default: true, label: 'Modal' },\n },\n guideline:\n 'Root of a dialog overlay. Compose as: DialogRoot > (DialogTrigger + DialogPortal > (DialogBackdrop + DialogViewport > DialogPopup > (DialogTitle + content + DialogClose))). Set modal=false only when the dialog must coexist with page interactions.',\n});\n\nexport const DialogTriggerDefinition = defineComponent<DialogTriggerProps>({\n name: 'DialogTrigger',\n importPath: '@vtex/faststore/components',\n component: DialogTrigger,\n editor: { label: 'Dialog Trigger', category: 'action' },\n schema: {},\n guideline:\n 'Opens the dialog when clicked. Direct child of DialogRoot. Accepts any children (text, Icon). Base UI connects it to DialogRoot via context — no explicit wiring needed.',\n});\n\nexport const DialogPortalDefinition = defineComponent<DialogPortalProps>({\n name: 'DialogPortal',\n importPath: '@vtex/faststore/components',\n component: DialogPortal,\n editor: { label: 'Dialog Portal', category: 'layout' },\n schema: {},\n guideline:\n 'Renders its children outside the DOM tree (into document.body, or into container when a parent swatch must reach the overlay). Place DialogBackdrop and DialogViewport as direct children, in that order.',\n});\n\nexport const DialogBackdropDefinition = defineComponent<DialogBackdropProps>({\n name: 'DialogBackdrop',\n importPath: '@vtex/faststore/components',\n component: DialogBackdrop,\n editor: { label: 'Dialog Backdrop', category: 'layout' },\n schema: {},\n guideline:\n 'Semi-transparent overlay behind the popup. Direct child of DialogPortal, before DialogViewport. Clicking it closes the dialog unless disablePointerDismissal is set on DialogRoot.',\n});\n\nexport const DialogViewportDefinition = defineComponent<DialogViewportProps>({\n name: 'DialogViewport',\n importPath: '@vtex/faststore/components',\n component: DialogViewport,\n editor: { label: 'Dialog Viewport', category: 'layout' },\n schema: {},\n guideline:\n 'Positioning container for DialogPopup. Direct child of DialogPortal, after DialogBackdrop. Apply fixed positioning and centering here (e.g. fixed inset-0 flex items-center justify-center). Place DialogPopup inside.',\n});\n\nexport const DialogPopupDefinition = defineComponent<DialogPopupProps>({\n name: 'DialogPopup',\n importPath: '@vtex/faststore/components',\n component: DialogPopup,\n editor: { label: 'Dialog Popup', category: 'layout' },\n schema: {},\n guideline:\n 'The visible dialog panel, inside DialogViewport. Place DialogTitle (required), optional DialogDescription, your content, and DialogClose inside. Style with a background, padding, and shadow.',\n});\n\nexport const DialogTitleDefinition = defineComponent<DialogTitleProps>({\n name: 'DialogTitle',\n importPath: '@vtex/faststore/components',\n component: DialogTitle,\n editor: { label: 'Dialog Title', category: 'layout' },\n schema: {},\n guideline:\n 'Required heading inside DialogPopup — sets the accessible name of the dialog for screen readers. Use sr-only to hide it visually when a visual title already exists.',\n});\n\nexport const DialogDescriptionDefinition = defineComponent<DialogDescriptionProps>({\n name: 'DialogDescription',\n importPath: '@vtex/faststore/components',\n component: DialogDescription,\n editor: { label: 'Dialog Description', category: 'layout' },\n schema: {},\n guideline:\n 'Optional description inside DialogPopup, after DialogTitle. Provides additional context to screen readers. Omit if the dialog content is self-explanatory.',\n});\n\nexport const DialogCloseDefinition = defineComponent<DialogCloseProps>({\n name: 'DialogClose',\n importPath: '@vtex/faststore/components',\n component: DialogClose,\n editor: { label: 'Dialog Close', category: 'action' },\n schema: {},\n guideline:\n 'Closes the dialog when clicked. Place inside DialogPopup — can appear multiple times (e.g., close icon at top-right and a Cancel button at the bottom).',\n});\n\nexport function DialogRoot({ open, defaultOpen, modal = true, onOpenChange, children }: DialogRootProps) {\n return (\n <BaseDialog.Root open={open} defaultOpen={defaultOpen} modal={modal} onOpenChange={onOpenChange}>\n {children}\n </BaseDialog.Root>\n );\n}\n\nexport function DialogTrigger({ className, children, ...props }: DialogTriggerProps) {\n return (\n <BaseDialog.Trigger {...props} className={className} data-fs-dialog-trigger=\"\">\n {children}\n </BaseDialog.Trigger>\n );\n}\n\nexport function DialogPortal({ children, container }: DialogPortalProps) {\n return <BaseDialog.Portal container={container}>{children}</BaseDialog.Portal>;\n}\n\nexport function DialogBackdrop({ className, children, ...props }: DialogBackdropProps) {\n return (\n <BaseDialog.Backdrop {...props} className={className} data-fs-dialog-backdrop=\"\">\n {children}\n </BaseDialog.Backdrop>\n );\n}\n\nexport function DialogViewport({ className, children, ...props }: DialogViewportProps) {\n return (\n <div {...props} className={className} data-fs-dialog-viewport=\"\">\n {children}\n </div>\n );\n}\n\nexport function DialogPopup({ className, children, ...props }: DialogPopupProps) {\n return (\n <BaseDialog.Popup {...props} className={className} data-fs-dialog-popup=\"\">\n {children}\n </BaseDialog.Popup>\n );\n}\n\nexport function DialogTitle({ className, children, ...props }: DialogTitleProps) {\n return (\n <BaseDialog.Title {...props} className={className} data-fs-dialog-title=\"\">\n {children}\n </BaseDialog.Title>\n );\n}\n\nexport function DialogDescription({ className, children, ...props }: DialogDescriptionProps) {\n return (\n <BaseDialog.Description {...props} className={className} data-fs-dialog-description=\"\">\n {children}\n </BaseDialog.Description>\n );\n}\n\nexport function DialogClose({ className, children, ...props }: DialogCloseProps) {\n return (\n <BaseDialog.Close {...props} className={className} data-fs-dialog-close=\"\">\n {children}\n </BaseDialog.Close>\n );\n}\n\nexport const Dialog = {\n Root: DialogRoot,\n Trigger: DialogTrigger,\n Portal: DialogPortal,\n Backdrop: DialogBackdrop,\n Viewport: DialogViewport,\n Popup: DialogPopup,\n Title: DialogTitle,\n Description: DialogDescription,\n Close: DialogClose,\n};\n"],"mappings":";;;;;;AAiCA,MAAa,uBAAuB,gBAAiC;CACnE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAe,UAAU;CAAS;CACnD,QAAQ,EACN,OAAO;EAAE,MAAM;EAAW,SAAS;EAAM,OAAO;CAAQ,EAC1D;CACA,WACE;AACJ,CAAC;AAED,MAAa,0BAA0B,gBAAoC;CACzE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAkB,UAAU;CAAS;CACtD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,yBAAyB,gBAAmC;CACvE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAiB,UAAU;CAAS;CACrD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,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AZ;EAA8B;EAAY;CAA4B,CAAA;AAC/E;AAEA,SAAgB,eAAe,EAAE,WAAW,UAAU,GAAG,SAA8B;CACrF,OACE,oBAACA,OAAW,UAAZ;EAAqB,GAAI;EAAkB;EAAW,2BAAwB;EAC3E;CACkB,CAAA;AAEzB;AAEA,SAAgB,eAAe,EAAE,WAAW,UAAU,GAAG,SAA8B;CACrF,OACE,oBAAC,OAAD;EAAK,GAAI;EAAkB;EAAW,2BAAwB;EAC3D;CACE,CAAA;AAET;AAEA,SAAgB,YAAY,EAAE,WAAW,UAAU,GAAG,SAA2B;CAC/E,OACE,oBAACA,OAAW,OAAZ;EAAkB,GAAI;EAAkB;EAAW,wBAAqB;EACrE;CACe,CAAA;AAEtB;AAEA,SAAgB,YAAY,EAAE,WAAW,UAAU,GAAG,SAA2B;CAC/E,OACE,oBAACA,OAAW,OAAZ;EAAkB,GAAI;EAAkB;EAAW,wBAAqB;EACrE;CACe,CAAA;AAEtB;AAEA,SAAgB,kBAAkB,EAAE,WAAW,UAAU,GAAG,SAAiC;CAC3F,OACE,oBAACA,OAAW,aAAZ;EAAwB,GAAI;EAAkB;EAAW,8BAA2B;EACjF;CACqB,CAAA;AAE5B;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,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,OAAO;CACP,OAAO;CACP,aAAa;CACb,OAAO;AACT"}
|
|
@@ -106,7 +106,7 @@ const DrawerCloseDefinition = defineComponent({
|
|
|
106
106
|
category: "action"
|
|
107
107
|
},
|
|
108
108
|
schema: {},
|
|
109
|
-
guideline: "Button that closes the drawer. Place at the top of Drawer.Popup.
|
|
109
|
+
guideline: "Button that closes the drawer. Place at the top of Drawer.Popup. It renders no label of its own, so an icon-only close needs an aria-label in the store language."
|
|
110
110
|
});
|
|
111
111
|
function DrawerRoot({ swipeDirection = "right", modal = true, children, ...props }) {
|
|
112
112
|
return /* @__PURE__ */ jsx(Drawer.Root, {
|