@vtex/faststore 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +0 -1
- 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/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 +20 -0
- package/dist/sdk/payment/bin-format.js.map +1 -0
- package/dist/sdk/payment/challenge-return.js +37 -0
- package/dist/sdk/payment/challenge-return.js.map +1 -0
- package/dist/sdk/payment/confirmation-last-four.js +39 -0
- package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
- package/dist/sdk/payment/gateway.d.ts +1 -1
- package/dist/sdk/payment/gateway.js +8 -2
- package/dist/sdk/payment/gateway.js.map +1 -1
- package/dist/sdk/payment/operations.d.ts +1 -0
- package/dist/sdk/payment/operations.js +28 -6
- package/dist/sdk/payment/operations.js.map +1 -1
- package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
- package/dist/sdk/payment/resumed-purchase.js +119 -0
- package/dist/sdk/payment/resumed-purchase.js.map +1 -0
- package/dist/sdk/payment/security-code-mask.js +16 -23
- package/dist/sdk/payment/security-code-mask.js.map +1 -1
- package/dist/sdk/payment/submission-registry.js +6 -2
- package/dist/sdk/payment/submission-registry.js.map +1 -1
- package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
- package/dist/sdk/payment/use-payment-actions.js +23 -3
- package/dist/sdk/payment/use-payment-actions.js.map +1 -1
- package/dist/sdk/payment/use-place-order.d.ts +10 -2
- package/dist/sdk/payment/use-place-order.js +138 -76
- package/dist/sdk/payment/use-place-order.js.map +1 -1
- package/dist/sdk/provider/storefront-provider.d.ts +1 -7
- package/dist/sdk/provider/storefront-provider.js +4 -11
- package/dist/sdk/provider/storefront-provider.js.map +1 -1
- package/dist/sdk/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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","names":["BaseDrawer","Drawer"],"sources":["../../../src/particles/drawer/drawer.tsx"],"sourcesContent":["'use client';\nimport { Drawer as BaseDrawer } from '@base-ui/react/drawer';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\n\nexport type DrawerSwipeDirection = 'up' | 'down' | 'left' | 'right';\n\nexport type DrawerRootProps = {\n swipeDirection?: DrawerSwipeDirection;\n modal?: boolean;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean, eventDetails: { isCanceled: boolean }) => void;\n children?: ReactNode;\n};\n\nexport type DrawerTriggerProps = ComponentPropsWithRef<'button'>;\n\nexport type DrawerPortalProps = {\n children?: ReactNode;\n};\n\nexport type DrawerBackdropProps = ComponentPropsWithRef<'div'>;\n\nexport type DrawerPopupProps = ComponentPropsWithRef<'div'>;\n\nexport type DrawerTitleProps = ComponentPropsWithRef<'h2'>;\n\nexport type DrawerDescriptionProps = ComponentPropsWithRef<'p'>;\n\nexport type DrawerCloseProps = ComponentPropsWithRef<'button'>;\n\nexport const DrawerRootDefinition = defineComponent<DrawerRootProps>({\n name: 'DrawerRoot',\n importPath: '@vtex/faststore/components',\n component: DrawerRoot,\n editor: { label: 'Drawer Root', category: 'layout' },\n schema: {\n swipeDirection: { type: ['up', 'down', 'left', 'right'] as const, default: 'right', label: 'Swipe Direction' },\n modal: { type: 'boolean', default: true, label: 'Modal' },\n },\n guideline:\n 'Root of a drawer side panel. When modal (the default) it delivers the full overlay contract: focus trapping inside the popup, body scroll lock on the page behind it, Escape-to-close, and backdrop-click dismissal — all inherited from Base UI, none re-implemented in the layout. Compose as: DrawerRoot > (DrawerTrigger + DrawerPortal > (DrawerBackdrop + DrawerPopup > (DrawerTitle + DrawerDescription + content + DrawerClose))). Set swipeDirection to control the slide edge (right for cart/filters, bottom for mobile menus); modal=false only when the drawer must coexist with page interactions (drops focus trap and scroll lock).',\n});\n\nexport const DrawerTriggerDefinition = defineComponent<DrawerTriggerProps>({\n name: 'DrawerTrigger',\n importPath: '@vtex/faststore/components',\n component: DrawerTrigger,\n editor: { label: 'Drawer Trigger', category: 'action' },\n schema: {},\n guideline: 'Button that opens the Drawer. Place inside or outside Drawer.Root — Base UI connects them via context.',\n});\n\nexport const DrawerPortalDefinition = defineComponent<DrawerPortalProps>({\n name: 'DrawerPortal',\n importPath: '@vtex/faststore/components',\n component: DrawerPortal,\n editor: { label: 'Drawer Portal', category: 'layout' },\n schema: {},\n guideline:\n 'Portal wrapper that renders Drawer.Backdrop and Drawer.Popup outside the DOM tree. Always wrap both inside Drawer.Portal.',\n});\n\nexport const DrawerBackdropDefinition = defineComponent<DrawerBackdropProps>({\n name: 'DrawerBackdrop',\n importPath: '@vtex/faststore/components',\n component: DrawerBackdrop,\n editor: { label: 'Drawer Backdrop', category: 'layout' },\n schema: {},\n guideline:\n 'Semi-transparent overlay rendered behind the popup. Clicking it dismisses the drawer unless disablePointerDismissal is set on Drawer.Root.',\n});\n\nexport const DrawerPopupDefinition = defineComponent<DrawerPopupProps>({\n name: 'DrawerPopup',\n importPath: '@vtex/faststore/components',\n component: DrawerPopup,\n editor: { label: 'Drawer Popup', category: 'layout' },\n schema: {},\n guideline:\n 'Main drawer panel. Animation and positioning are controlled by swipeDirection on Drawer.Root. Contains Drawer.Title, content, and Drawer.Close.',\n});\n\nexport const DrawerTitleDefinition = defineComponent<DrawerTitleProps>({\n name: 'DrawerTitle',\n importPath: '@vtex/faststore/components',\n component: DrawerTitle,\n editor: { label: 'Drawer Title', category: 'layout' },\n schema: {},\n guideline:\n 'Semantic heading inside Drawer.Popup. Required for screen reader accessibility — sets the accessible name of the dialog.',\n});\n\nexport const DrawerDescriptionDefinition = defineComponent<DrawerDescriptionProps>({\n name: 'DrawerDescription',\n importPath: '@vtex/faststore/components',\n component: DrawerDescription,\n editor: { label: 'Drawer Description', category: 'layout' },\n schema: {},\n guideline: 'Accessible description of the drawer. Optional but recommended for screen readers.',\n});\n\nexport const DrawerCloseDefinition = defineComponent<DrawerCloseProps>({\n name: 'DrawerClose',\n importPath: '@vtex/faststore/components',\n component: DrawerClose,\n editor: { label: 'Drawer Close', category: 'action' },\n schema: {},\n guideline:\n 'Button that closes the drawer. Place at the top of Drawer.Popup.
|
|
1
|
+
{"version":3,"file":"drawer.js","names":["BaseDrawer","Drawer"],"sources":["../../../src/particles/drawer/drawer.tsx"],"sourcesContent":["'use client';\nimport { Drawer as BaseDrawer } from '@base-ui/react/drawer';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\n\nexport type DrawerSwipeDirection = 'up' | 'down' | 'left' | 'right';\n\nexport type DrawerRootProps = {\n swipeDirection?: DrawerSwipeDirection;\n modal?: boolean;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean, eventDetails: { isCanceled: boolean }) => void;\n children?: ReactNode;\n};\n\nexport type DrawerTriggerProps = ComponentPropsWithRef<'button'>;\n\nexport type DrawerPortalProps = {\n children?: ReactNode;\n};\n\nexport type DrawerBackdropProps = ComponentPropsWithRef<'div'>;\n\nexport type DrawerPopupProps = ComponentPropsWithRef<'div'>;\n\nexport type DrawerTitleProps = ComponentPropsWithRef<'h2'>;\n\nexport type DrawerDescriptionProps = ComponentPropsWithRef<'p'>;\n\nexport type DrawerCloseProps = ComponentPropsWithRef<'button'>;\n\nexport const DrawerRootDefinition = defineComponent<DrawerRootProps>({\n name: 'DrawerRoot',\n importPath: '@vtex/faststore/components',\n component: DrawerRoot,\n editor: { label: 'Drawer Root', category: 'layout' },\n schema: {\n swipeDirection: { type: ['up', 'down', 'left', 'right'] as const, default: 'right', label: 'Swipe Direction' },\n modal: { type: 'boolean', default: true, label: 'Modal' },\n },\n guideline:\n 'Root of a drawer side panel. When modal (the default) it delivers the full overlay contract: focus trapping inside the popup, body scroll lock on the page behind it, Escape-to-close, and backdrop-click dismissal — all inherited from Base UI, none re-implemented in the layout. Compose as: DrawerRoot > (DrawerTrigger + DrawerPortal > (DrawerBackdrop + DrawerPopup > (DrawerTitle + DrawerDescription + content + DrawerClose))). Set swipeDirection to control the slide edge (right for cart/filters, bottom for mobile menus); modal=false only when the drawer must coexist with page interactions (drops focus trap and scroll lock).',\n});\n\nexport const DrawerTriggerDefinition = defineComponent<DrawerTriggerProps>({\n name: 'DrawerTrigger',\n importPath: '@vtex/faststore/components',\n component: DrawerTrigger,\n editor: { label: 'Drawer Trigger', category: 'action' },\n schema: {},\n guideline: 'Button that opens the Drawer. Place inside or outside Drawer.Root — Base UI connects them via context.',\n});\n\nexport const DrawerPortalDefinition = defineComponent<DrawerPortalProps>({\n name: 'DrawerPortal',\n importPath: '@vtex/faststore/components',\n component: DrawerPortal,\n editor: { label: 'Drawer Portal', category: 'layout' },\n schema: {},\n guideline:\n 'Portal wrapper that renders Drawer.Backdrop and Drawer.Popup outside the DOM tree. Always wrap both inside Drawer.Portal.',\n});\n\nexport const DrawerBackdropDefinition = defineComponent<DrawerBackdropProps>({\n name: 'DrawerBackdrop',\n importPath: '@vtex/faststore/components',\n component: DrawerBackdrop,\n editor: { label: 'Drawer Backdrop', category: 'layout' },\n schema: {},\n guideline:\n 'Semi-transparent overlay rendered behind the popup. Clicking it dismisses the drawer unless disablePointerDismissal is set on Drawer.Root.',\n});\n\nexport const DrawerPopupDefinition = defineComponent<DrawerPopupProps>({\n name: 'DrawerPopup',\n importPath: '@vtex/faststore/components',\n component: DrawerPopup,\n editor: { label: 'Drawer Popup', category: 'layout' },\n schema: {},\n guideline:\n 'Main drawer panel. Animation and positioning are controlled by swipeDirection on Drawer.Root. Contains Drawer.Title, content, and Drawer.Close.',\n});\n\nexport const DrawerTitleDefinition = defineComponent<DrawerTitleProps>({\n name: 'DrawerTitle',\n importPath: '@vtex/faststore/components',\n component: DrawerTitle,\n editor: { label: 'Drawer Title', category: 'layout' },\n schema: {},\n guideline:\n 'Semantic heading inside Drawer.Popup. Required for screen reader accessibility — sets the accessible name of the dialog.',\n});\n\nexport const DrawerDescriptionDefinition = defineComponent<DrawerDescriptionProps>({\n name: 'DrawerDescription',\n importPath: '@vtex/faststore/components',\n component: DrawerDescription,\n editor: { label: 'Drawer Description', category: 'layout' },\n schema: {},\n guideline: 'Accessible description of the drawer. Optional but recommended for screen readers.',\n});\n\nexport const DrawerCloseDefinition = defineComponent<DrawerCloseProps>({\n name: 'DrawerClose',\n importPath: '@vtex/faststore/components',\n component: DrawerClose,\n editor: { label: 'Drawer Close', category: 'action' },\n schema: {},\n guideline:\n '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.',\n});\n\nexport function DrawerRoot({ swipeDirection = 'right', modal = true, children, ...props }: DrawerRootProps) {\n return (\n <BaseDrawer.Root {...props} swipeDirection={swipeDirection} modal={modal}>\n {children}\n </BaseDrawer.Root>\n );\n}\n\nexport function DrawerTrigger({ className, children, ...props }: DrawerTriggerProps) {\n return (\n <BaseDrawer.Trigger {...props} className={className} data-fs-drawer-trigger=\"\">\n {children}\n </BaseDrawer.Trigger>\n );\n}\n\nexport function DrawerPortal({ children }: DrawerPortalProps) {\n return <BaseDrawer.Portal>{children}</BaseDrawer.Portal>;\n}\n\nexport function DrawerBackdrop({ className, children, ...props }: DrawerBackdropProps) {\n return (\n <BaseDrawer.Backdrop {...props} className={className} data-fs-drawer-backdrop=\"\">\n {children}\n </BaseDrawer.Backdrop>\n );\n}\n\nexport function DrawerPopup({ className, children, ...props }: DrawerPopupProps) {\n return (\n <BaseDrawer.Popup {...props} className={className} data-fs-drawer-popup=\"\">\n {children}\n </BaseDrawer.Popup>\n );\n}\n\nexport function DrawerTitle({ className, children, ...props }: DrawerTitleProps) {\n return (\n <BaseDrawer.Title {...props} className={className} data-fs-drawer-title=\"\">\n {children}\n </BaseDrawer.Title>\n );\n}\n\nexport function DrawerDescription({ className, children, ...props }: DrawerDescriptionProps) {\n return (\n <BaseDrawer.Description {...props} className={className} data-fs-drawer-description=\"\">\n {children}\n </BaseDrawer.Description>\n );\n}\n\nexport function DrawerClose({ className, children, ...props }: DrawerCloseProps) {\n return (\n <BaseDrawer.Close {...props} className={className} data-fs-drawer-close=\"\">\n {children}\n </BaseDrawer.Close>\n );\n}\n\nexport const Drawer = {\n Root: DrawerRoot,\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Backdrop: DrawerBackdrop,\n Popup: DrawerPopup,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Close: DrawerClose,\n};\n"],"mappings":";;;;;;AAgCA,MAAa,uBAAuB,gBAAiC;CACnE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAe,UAAU;CAAS;CACnD,QAAQ;EACN,gBAAgB;GAA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'>, 'defaultValue'
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
required?: boolean;
|
|
16
16
|
name?: string;
|
|
17
|
+
autoComplete?: string;
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
19
20
|
* Email format rule, ported from the legacy `EMAIL_VALIDATE_REGEX` (fastcheckout `validations.ts`).
|
|
@@ -32,6 +33,6 @@ export declare const EmailFieldDefinition: ComponentDefinition<EmailFieldProps>;
|
|
|
32
33
|
* forces `invalid` (e.g. a server-side error from `EmailIdentificationControl`). It consumes no
|
|
33
34
|
* GraphQL and no domain context — value flows through `value`/`defaultValue`/`onValueChange`.
|
|
34
35
|
*/
|
|
35
|
-
export declare function EmailField({ value, defaultValue, onValueChange, onBlur, invalid, errorMessage, label, placeholder, disabled, required, name, className, ...props }: EmailFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare function EmailField({ value, defaultValue, onValueChange, onBlur, invalid, errorMessage, label, placeholder, disabled, required, name, autoComplete, className, ...props }: EmailFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
36
37
|
//#endregion
|
|
37
38
|
//# sourceMappingURL=email-field.d.ts.map
|
|
@@ -57,7 +57,7 @@ const EmailFieldDefinition = defineComponent({
|
|
|
57
57
|
* forces `invalid` (e.g. a server-side error from `EmailIdentificationControl`). It consumes no
|
|
58
58
|
* GraphQL and no domain context — value flows through `value`/`defaultValue`/`onValueChange`.
|
|
59
59
|
*/
|
|
60
|
-
function EmailField({ value, defaultValue = "", onValueChange, onBlur, invalid = false, errorMessage, label, placeholder, disabled = false, required = true, name = "email", className, ...props }) {
|
|
60
|
+
function EmailField({ value, defaultValue = "", onValueChange, onBlur, invalid = false, errorMessage, label, placeholder, disabled = false, required = true, name = "email", autoComplete, className, ...props }) {
|
|
61
61
|
const isControlled = value !== void 0;
|
|
62
62
|
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
63
63
|
const [formatInvalid, setFormatInvalid] = useState(false);
|
|
@@ -86,6 +86,7 @@ function EmailField({ value, defaultValue = "", onValueChange, onBlur, invalid =
|
|
|
86
86
|
/* @__PURE__ */ jsx(Field.Control, {
|
|
87
87
|
type: "email",
|
|
88
88
|
name,
|
|
89
|
+
autoComplete,
|
|
89
90
|
required,
|
|
90
91
|
placeholder,
|
|
91
92
|
disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-field.js","names":[],"sources":["../../../src/particles/email-field/email-field.tsx"],"sourcesContent":["'use client';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ChangeEvent, ComponentPropsWithRef, FocusEvent } from 'react';\nimport { useState } from 'react';\nimport { Field } from '../field/field.js';\n\nexport type EmailFieldProps = Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'value' | 'onChange' | 'onBlur'> & {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n invalid?: boolean;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n disabled?: boolean;\n required?: boolean;\n name?: string;\n};\n\n/**\n * Email format rule, ported from the legacy `EMAIL_VALIDATE_REGEX` (fastcheckout `validations.ts`).\n * The exact legacy source was unavailable at authoring time, so this uses the WHATWG/HTML5 email-input\n * pattern — the same rule the browser applies to `<input type=\"email\">`. Format validation runs on\n * blur/submit only, never per keystroke (Invariants & Constraints).\n */\nexport const EMAIL_VALIDATE_REGEX =\n /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/;\n\n/** True when `value` is a well-formed email address. Trims surrounding whitespace before testing. */\nexport function isValidEmail(value: string): boolean {\n return EMAIL_VALIDATE_REGEX.test(value.trim());\n}\n\nexport const EmailFieldDefinition = defineComponent<EmailFieldProps>({\n name: 'EmailField',\n importPath: '@vtex/faststore/components',\n component: EmailField,\n editor: { label: 'Email Field', category: 'content' },\n schema: {\n label: { type: 'string', label: 'Label' },\n placeholder: { type: 'string', label: 'Placeholder' },\n errorMessage: { type: 'string', label: 'Error message' },\n required: { type: 'boolean', default: true, label: 'Required' },\n disabled: { type: 'boolean', default: false, label: 'Disabled' },\n },\n guideline:\n 'Presentational, data-agnostic email input with blur/submit format validation; for a checkout-bound field use EmailIdentificationControl instead. See email-field.md.',\n});\n\n/**\n * Presentational email input (particle). Composes the `Field` particle (`Field.Root` + `Field.Label` +\n * `Field.Control` + `Field.Error`) and owns email **format** validation: it validates on blur/submit\n * (never per keystroke) and surfaces `errorMessage` inline when the format is invalid or when the host\n * forces `invalid` (e.g. a server-side error from `EmailIdentificationControl`). It consumes no\n * GraphQL and no domain context — value flows through `value`/`defaultValue`/`onValueChange`.\n */\nexport function EmailField({\n value,\n defaultValue = '',\n onValueChange,\n onBlur,\n invalid = false,\n errorMessage,\n label,\n placeholder,\n disabled = false,\n required = true,\n name = 'email',\n className,\n ...props\n}: EmailFieldProps) {\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState(defaultValue);\n const [formatInvalid, setFormatInvalid] = useState(false);\n\n const currentValue = isControlled ? value : internalValue;\n const showInvalid = invalid || formatInvalid;\n\n function handleChange(event: ChangeEvent<HTMLInputElement>) {\n const next = event.target.value;\n if (!isControlled) setInternalValue(next);\n // Clear a prior format error while typing; it is re-evaluated on the next blur (no per-keystroke validation).\n if (formatInvalid) setFormatInvalid(false);\n onValueChange?.(next);\n }\n\n function handleBlur(event: FocusEvent<HTMLInputElement>) {\n const trimmed = currentValue.trim();\n setFormatInvalid(trimmed.length > 0 && !isValidEmail(trimmed));\n onBlur?.(event);\n }\n\n return (\n <Field.Root\n {...props}\n className={className}\n name={name}\n invalid={showInvalid}\n disabled={disabled}\n data-fs-email-field=\"\"\n >\n {label ? <Field.Label>{label}</Field.Label> : null}\n <Field.Control\n type=\"email\"\n name={name}\n required={required}\n placeholder={placeholder}\n disabled={disabled}\n onChange={handleChange}\n onBlur={handleBlur}\n {...(isControlled ? { value: currentValue } : { defaultValue })}\n />\n {showInvalid && errorMessage ? <Field.Error match>{errorMessage}</Field.Error> : null}\n </Field.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"email-field.js","names":[],"sources":["../../../src/particles/email-field/email-field.tsx"],"sourcesContent":["'use client';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ChangeEvent, ComponentPropsWithRef, FocusEvent } from 'react';\nimport { useState } from 'react';\nimport { Field } from '../field/field.js';\n\nexport type EmailFieldProps = Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'value' | 'onChange' | 'onBlur'> & {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n invalid?: boolean;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n disabled?: boolean;\n required?: boolean;\n name?: string;\n autoComplete?: string;\n};\n\n/**\n * Email format rule, ported from the legacy `EMAIL_VALIDATE_REGEX` (fastcheckout `validations.ts`).\n * The exact legacy source was unavailable at authoring time, so this uses the WHATWG/HTML5 email-input\n * pattern — the same rule the browser applies to `<input type=\"email\">`. Format validation runs on\n * blur/submit only, never per keystroke (Invariants & Constraints).\n */\nexport const EMAIL_VALIDATE_REGEX =\n /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/;\n\n/** True when `value` is a well-formed email address. Trims surrounding whitespace before testing. */\nexport function isValidEmail(value: string): boolean {\n return EMAIL_VALIDATE_REGEX.test(value.trim());\n}\n\nexport const EmailFieldDefinition = defineComponent<EmailFieldProps>({\n name: 'EmailField',\n importPath: '@vtex/faststore/components',\n component: EmailField,\n editor: { label: 'Email Field', category: 'content' },\n schema: {\n label: { type: 'string', label: 'Label' },\n placeholder: { type: 'string', label: 'Placeholder' },\n errorMessage: { type: 'string', label: 'Error message' },\n required: { type: 'boolean', default: true, label: 'Required' },\n disabled: { type: 'boolean', default: false, label: 'Disabled' },\n },\n guideline:\n 'Presentational, data-agnostic email input with blur/submit format validation; for a checkout-bound field use EmailIdentificationControl instead. See email-field.md.',\n});\n\n/**\n * Presentational email input (particle). Composes the `Field` particle (`Field.Root` + `Field.Label` +\n * `Field.Control` + `Field.Error`) and owns email **format** validation: it validates on blur/submit\n * (never per keystroke) and surfaces `errorMessage` inline when the format is invalid or when the host\n * forces `invalid` (e.g. a server-side error from `EmailIdentificationControl`). It consumes no\n * GraphQL and no domain context — value flows through `value`/`defaultValue`/`onValueChange`.\n */\nexport function EmailField({\n value,\n defaultValue = '',\n onValueChange,\n onBlur,\n invalid = false,\n errorMessage,\n label,\n placeholder,\n disabled = false,\n required = true,\n name = 'email',\n autoComplete,\n className,\n ...props\n}: EmailFieldProps) {\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState(defaultValue);\n const [formatInvalid, setFormatInvalid] = useState(false);\n\n const currentValue = isControlled ? value : internalValue;\n const showInvalid = invalid || formatInvalid;\n\n function handleChange(event: ChangeEvent<HTMLInputElement>) {\n const next = event.target.value;\n if (!isControlled) setInternalValue(next);\n // Clear a prior format error while typing; it is re-evaluated on the next blur (no per-keystroke validation).\n if (formatInvalid) setFormatInvalid(false);\n onValueChange?.(next);\n }\n\n function handleBlur(event: FocusEvent<HTMLInputElement>) {\n const trimmed = currentValue.trim();\n setFormatInvalid(trimmed.length > 0 && !isValidEmail(trimmed));\n onBlur?.(event);\n }\n\n return (\n <Field.Root\n {...props}\n className={className}\n name={name}\n invalid={showInvalid}\n disabled={disabled}\n data-fs-email-field=\"\"\n >\n {label ? <Field.Label>{label}</Field.Label> : null}\n <Field.Control\n type=\"email\"\n name={name}\n autoComplete={autoComplete}\n required={required}\n placeholder={placeholder}\n disabled={disabled}\n onChange={handleChange}\n onBlur={handleBlur}\n {...(isControlled ? { value: currentValue } : { defaultValue })}\n />\n {showInvalid && errorMessage ? <Field.Error match>{errorMessage}</Field.Error> : null}\n </Field.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA2BA,MAAa,uBACX;;AAGF,SAAgB,aAAa,OAAwB;CACnD,OAAO,qBAAqB,KAAK,MAAM,KAAK,CAAC;AAC/C;AAEA,MAAa,uBAAuB,gBAAiC;CACnE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAe,UAAU;CAAU;CACpD,QAAQ;EACN,OAAO;GAAE,MAAM;GAAU,OAAO;EAAQ;EACxC,aAAa;GAAE,MAAM;GAAU,OAAO;EAAc;EACpD,cAAc;GAAE,MAAM;GAAU,OAAO;EAAgB;EACvD,UAAU;GAAE,MAAM;GAAW,SAAS;GAAM,OAAO;EAAW;EAC9D,UAAU;GAAE,MAAM;GAAW,SAAS;GAAO,OAAO;EAAW;CACjE;CACA,WACE;AACJ,CAAC;;;;;;;;AASD,SAAgB,WAAW,EACzB,OACA,eAAe,IACf,eACA,QACA,UAAU,OACV,cACA,OACA,aACA,WAAW,OACX,WAAW,MACX,OAAO,SACP,cACA,WACA,GAAG,SACe;CAClB,MAAM,eAAe,UAAU,KAAA;CAC/B,MAAM,CAAC,eAAe,oBAAoB,SAAS,YAAY;CAC/D,MAAM,CAAC,eAAe,oBAAoB,SAAS,KAAK;CAExD,MAAM,eAAe,eAAe,QAAQ;CAC5C,MAAM,cAAc,WAAW;CAE/B,SAAS,aAAa,OAAsC;EAC1D,MAAM,OAAO,MAAM,OAAO;EAC1B,IAAI,CAAC,cAAc,iBAAiB,IAAI;EAExC,IAAI,eAAe,iBAAiB,KAAK;EACzC,gBAAgB,IAAI;CACtB;CAEA,SAAS,WAAW,OAAqC;EACvD,MAAM,UAAU,aAAa,KAAK;EAClC,iBAAiB,QAAQ,SAAS,KAAK,CAAC,aAAa,OAAO,CAAC;EAC7D,SAAS,KAAK;CAChB;CAEA,OACE,qBAAC,MAAM,MAAP;EACE,GAAI;EACO;EACL;EACN,SAAS;EACC;EACV,uBAAoB;EANtB,UAAA;GAQG,QAAQ,oBAAC,MAAM,OAAP,EAAA,UAAc,MAAmB,CAAA,IAAI;GAC9C,oBAAC,MAAM,SAAP;IACE,MAAK;IACC;IACQ;IACJ;IACG;IACH;IACV,UAAU;IACV,QAAQ;IACR,GAAK,eAAe,EAAE,OAAO,aAAa,IAAI,EAAE,aAAa;GAC9D,CAAA;GACA,eAAe,eAAe,oBAAC,MAAM,OAAP;IAAa,OAAA;IAAO,UAAA;GAA0B,CAAA,IAAI;EACvE;;AAEhB"}
|
|
@@ -132,6 +132,7 @@ function FooterLinkGroup({ heading, links, $content, className, ...props }) {
|
|
|
132
132
|
className,
|
|
133
133
|
"data-fs-footer-link-group": "",
|
|
134
134
|
children: [/* @__PURE__ */ jsx(AccordionRoot, {
|
|
135
|
+
role: "group",
|
|
135
136
|
"data-fs-footer-link-group-accordion": "",
|
|
136
137
|
children: /* @__PURE__ */ jsxs(AccordionItem, {
|
|
137
138
|
value: ACCORDION_ITEM_VALUE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer-link-group.js","names":[],"sources":["../../../src/particles/footer-link-group/footer-link-group.tsx"],"sourcesContent":["import { type ContentValue, defineComponent, defineContentType } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef } from 'react';\nimport type { PageRef } from '../../sdk/navigation/types.js';\nimport { resolveSafeHref } from '../../utils/safe-href.js';\nimport {\n AccordionHeader,\n AccordionItem,\n AccordionPanel,\n AccordionRoot,\n AccordionTrigger,\n} from '../accordion/accordion.js';\nimport { NavigationLink } from '../navigation-link/navigation-link.js';\n\n// ---------------------------------------------------------------------------\n// Content model\n// ---------------------------------------------------------------------------\n\nexport const FooterLinkGroupContent = defineContentType({\n id: 'footer-link-group',\n title: 'Footer Link Group',\n description: 'A heading and its ordered list of institutional links.',\n schema: {\n type: 'object',\n additionalProperties: false,\n // Neither property is required. A missing element key already omits the component before any\n // required check runs, so requiring them would buy nothing and cost the prop fallback: an entry\n // authoring one field alone would be shape-invalid and take the whole element down with it. The\n // render gate holds the heading invariant instead, being the only point that sees both channels.\n properties: {\n heading: { type: 'string', minLength: 1, title: 'Group heading' },\n links: {\n type: 'array',\n title: 'Links',\n minItems: 1,\n items: {\n type: 'object',\n additionalProperties: false,\n required: ['label', 'href'],\n properties: {\n label: { type: 'string', minLength: 1, title: 'Label' },\n href: {\n type: 'string',\n minLength: 1,\n title: 'URL',\n format: 'uri-reference',\n // Author-time guidance only, and deliberately lookahead-free: nothing in this repo\n // compiles it, so its one consumer is the Content Platform Admin's form, whose regex\n // engine may be an RE2 family that rejects lookahead outright.\n pattern: '^(?:https?://.*|mailto:.+|tel:.+|/(?:[^/].*)?)$',\n },\n target: { type: 'string', enum: ['_self', '_blank'], default: '_self', title: 'Open in' },\n },\n },\n },\n },\n },\n});\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype FooterLinkGroupContentValue = ContentValue<typeof FooterLinkGroupContent>;\n\ntype FooterLinkGroupContentLink = NonNullable<FooterLinkGroupContentValue['links']>[number];\n\n/** One authored link. The prop accepts a page reference; a CMS href stays a string. */\nexport type FooterLinkGroupLink = Omit<FooterLinkGroupContentLink, 'href'> & {\n href: PageRef | string;\n};\n\nexport type FooterLinkGroupProps = ComponentPropsWithRef<'div'> & {\n /** Authored fallback for the group heading, used when no CMS entry supplies one. */\n heading?: string;\n /** Authored fallback for the link list, used when no CMS entry supplies one. */\n links?: readonly FooterLinkGroupLink[];\n /** Injected by the compiler, sliced from the page's or layout's composite content entry. */\n $content?: FooterLinkGroupContentValue;\n};\n\n// ---------------------------------------------------------------------------\n// Definition\n// ---------------------------------------------------------------------------\n\nexport const FooterLinkGroupDefinition = defineComponent({\n name: 'FooterLinkGroup',\n importPath: '@vtex/faststore/components',\n component: FooterLinkGroup,\n content: FooterLinkGroupContent,\n editor: { label: 'Footer Link Group', category: 'navigation' },\n schema: {\n heading: { type: 'string', label: 'Group heading' },\n links: { type: 'array', label: 'Links' },\n },\n guideline:\n \"One heading and its institutional links, both CMS-editable. Renders as a desktop column and a mobile accordion at the same time; the store's swatch pair decides which one a breakpoint shows. See footer-link-group.md.\",\n});\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\n/** A resolved link, ready for both forms. A null `href` is a destination the allowlist refused. */\ntype ResolvedLink = {\n label: string;\n href: PageRef | string | null;\n target: FooterLinkGroupLink['target'];\n};\n\nfunction readLinks(\n content: readonly FooterLinkGroupContentLink[] | undefined,\n authored: readonly FooterLinkGroupLink[] | undefined,\n): readonly FooterLinkGroupLink[] {\n if (content !== undefined) return content;\n return authored ?? [];\n}\n\nfunction resolveDestination(href: PageRef | string, index: number): PageRef | string | null {\n if (typeof href !== 'string') return href;\n\n const destination = resolveSafeHref(href);\n if (!destination.safe) {\n // A bounded reason and no authored value, the convention the content runtime's own log follows.\n console.warn('[FooterLinkGroup] link destination rejected', { index, reason: destination.reason });\n return null;\n }\n return destination.href;\n}\n\n/** Unique within its own root, and every group renders its own root. */\nconst ACCORDION_ITEM_VALUE = 'links';\n\n/**\n * Resolves the whole list once per render, so both forms show the same links and a refused\n * destination logs one line rather than two.\n */\nfunction resolveLinks(links: readonly FooterLinkGroupLink[]): ResolvedLink[] {\n const resolved: ResolvedLink[] = [];\n\n links.forEach((link, index) => {\n // `minLength` is enforced by neither the runtime slice nor the preflight, so a blank label\n // reaches the component. Drop the link: an anchor with no accessible name is a WCAG failure.\n if (link.label.trim().length === 0) {\n return;\n }\n resolved.push({\n label: link.label,\n href: resolveDestination(link.href, index),\n target: link.target,\n });\n });\n\n return resolved;\n}\n\nexport function FooterLinkGroup({ heading, links, $content, className, ...props }: FooterLinkGroupProps) {\n const groupHeading = $content?.heading ?? heading;\n // An entry supplying `links: []` beats an authored prop: a merchant who cleared the list cleared it.\n const resolved = resolveLinks(readLinks($content?.links, links));\n\n if (!groupHeading?.trim() || resolved.length === 0) {\n return null;\n }\n\n // One element rendered in both forms, so the two cannot drift.\n const list = (\n <ul data-fs-footer-link-group-list=\"\">\n {resolved.map((link, index) => (\n <li key={index} data-fs-footer-link-group-item=\"\">\n {link.href === null ? (\n <span data-fs-text=\"\" data-fs-footer-link-group-text=\"\">\n {link.label}\n </span>\n ) : (\n <NavigationLink href={link.href} target={link.target} data-fs-footer-link-group-link=\"\">\n {link.label}\n </NavigationLink>\n )}\n </li>\n ))}\n </ul>\n );\n\n return (\n <div {...props} className={className} data-fs-footer-link-group=\"\">\n <AccordionRoot data-fs-footer-link-group-accordion=\"\">\n <AccordionItem value={ACCORDION_ITEM_VALUE}>\n <AccordionHeader data-fs-footer-link-group-heading=\"\">\n <AccordionTrigger data-fs-text=\"\" data-fs-footer-link-group-trigger=\"\">\n {groupHeading}\n </AccordionTrigger>\n </AccordionHeader>\n {/* `hiddenUntilFound` requires the panel to stay mounted while closed, and the wrapper\n defaults `keepMounted` to false, so passing it keeps Base UI from warning about the pair. */}\n <AccordionPanel hiddenUntilFound keepMounted data-fs-footer-link-group-panel=\"\">\n {list}\n </AccordionPanel>\n </AccordionItem>\n </AccordionRoot>\n <div data-fs-footer-link-group-column=\"\">\n <h3 data-fs-text=\"\" data-fs-footer-link-group-heading=\"\">\n {groupHeading}\n </h3>\n {list}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAiBA,MAAa,yBAAyB,kBAAkB;CACtD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EAKtB,YAAY;GACV,SAAS;IAAE,MAAM;IAAU,WAAW;IAAG,OAAO;GAAgB;GAChE,OAAO;IACL,MAAM;IACN,OAAO;IACP,UAAU;IACV,OAAO;KACL,MAAM;KACN,sBAAsB;KACtB,UAAU,CAAC,SAAS,MAAM;KAC1B,YAAY;MACV,OAAO;OAAE,MAAM;OAAU,WAAW;OAAG,OAAO;MAAQ;MACtD,MAAM;OACJ,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KAAK,KAAK,SAAS,WAAW,GAC/C,OAAO;CAIT,MAAM,OACJ,oBAAC,MAAD;EAAI,kCAA+B;EAChC,UAAA,SAAS,KAAK,MAAM,UACnB,oBAAC,MAAD;GAAgB,kCAA+B;GAC5C,UAAA,KAAK,SAAS,OACb,oBAAC,QAAD;IAAM,gBAAa;IAAG,kCAA+B;IAClD,UAAA,KAAK;GACF,CAAA,IAEN,oBAAC,gBAAD;IAAgB,MAAM,KAAK;IAAM,QAAQ,KAAK;IAAQ,kCAA+B;IAClF,UAAA,KAAK;GACQ,CAAA;EAEhB,GAVK,KAUL,CACL;CACC,CAAA;CAGN,OACE,qBAAC,OAAD;EAAK,GAAI;EAAkB;EAAW,6BAA0B;EAAhE,UAAA,CACE,oBAAC,eAAD;GAAe,uCAAoC;GACjD,UAAA,qBAAC,eAAD;IAAe,OAAO;IAAtB,UAAA,CACE,oBAAC,iBAAD;KAAiB,qCAAkC;KACjD,UAAA,oBAAC,kBAAD;MAAkB,gBAAa;MAAG,qCAAkC;MACjE,UAAA;KACe,CAAA;IACH,CAAA,GAGjB,oBAAC,gBAAD;KAAgB,kBAAA;KAAiB,aAAA;KAAY,mCAAgC;KAC1E,UAAA;IACa,CAAA,CACH;;EACF,CAAA,GACf,qBAAC,OAAD;GAAK,oCAAiC;GAAtC,UAAA,CACE,oBAAC,MAAD;IAAI,gBAAa;IAAG,qCAAkC;IACnD,UAAA;GACC,CAAA,GACH,IACE;EACF,CAAA,CAAA;;AAET"}
|
|
1
|
+
{"version":3,"file":"footer-link-group.js","names":[],"sources":["../../../src/particles/footer-link-group/footer-link-group.tsx"],"sourcesContent":["import { type ContentValue, defineComponent, defineContentType } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef } from 'react';\nimport type { PageRef } from '../../sdk/navigation/types.js';\nimport { resolveSafeHref } from '../../utils/safe-href.js';\nimport {\n AccordionHeader,\n AccordionItem,\n AccordionPanel,\n AccordionRoot,\n AccordionTrigger,\n} from '../accordion/accordion.js';\nimport { NavigationLink } from '../navigation-link/navigation-link.js';\n\n// ---------------------------------------------------------------------------\n// Content model\n// ---------------------------------------------------------------------------\n\nexport const FooterLinkGroupContent = defineContentType({\n id: 'footer-link-group',\n title: 'Footer Link Group',\n description: 'A heading and its ordered list of institutional links.',\n schema: {\n type: 'object',\n additionalProperties: false,\n // Neither property is required. A missing element key already omits the component before any\n // required check runs, so requiring them would buy nothing and cost the prop fallback: an entry\n // authoring one field alone would be shape-invalid and take the whole element down with it. The\n // render gate holds the heading invariant instead, being the only point that sees both channels.\n properties: {\n heading: { type: 'string', minLength: 1, title: 'Group heading' },\n links: {\n type: 'array',\n title: 'Links',\n minItems: 1,\n items: {\n type: 'object',\n additionalProperties: false,\n required: ['label', 'href'],\n properties: {\n label: { type: 'string', minLength: 1, title: 'Label' },\n href: {\n type: 'string',\n minLength: 1,\n title: 'URL',\n format: 'uri-reference',\n // Author-time guidance only, and deliberately lookahead-free: nothing in this repo\n // compiles it, so its one consumer is the Content Platform Admin's form, whose regex\n // engine may be an RE2 family that rejects lookahead outright.\n pattern: '^(?:https?://.*|mailto:.+|tel:.+|/(?:[^/].*)?)$',\n },\n target: { type: 'string', enum: ['_self', '_blank'], default: '_self', title: 'Open in' },\n },\n },\n },\n },\n },\n});\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype FooterLinkGroupContentValue = ContentValue<typeof FooterLinkGroupContent>;\n\ntype FooterLinkGroupContentLink = NonNullable<FooterLinkGroupContentValue['links']>[number];\n\n/** One authored link. The prop accepts a page reference; a CMS href stays a string. */\nexport type FooterLinkGroupLink = Omit<FooterLinkGroupContentLink, 'href'> & {\n href: PageRef | string;\n};\n\nexport type FooterLinkGroupProps = ComponentPropsWithRef<'div'> & {\n /** Authored fallback for the group heading, used when no CMS entry supplies one. */\n heading?: string;\n /** Authored fallback for the link list, used when no CMS entry supplies one. */\n links?: readonly FooterLinkGroupLink[];\n /** Injected by the compiler, sliced from the page's or layout's composite content entry. */\n $content?: FooterLinkGroupContentValue;\n};\n\n// ---------------------------------------------------------------------------\n// Definition\n// ---------------------------------------------------------------------------\n\nexport const FooterLinkGroupDefinition = defineComponent({\n name: 'FooterLinkGroup',\n importPath: '@vtex/faststore/components',\n component: FooterLinkGroup,\n content: FooterLinkGroupContent,\n editor: { label: 'Footer Link Group', category: 'navigation' },\n schema: {\n heading: { type: 'string', label: 'Group heading' },\n links: { type: 'array', label: 'Links' },\n },\n guideline:\n \"One heading and its institutional links, both CMS-editable. Renders as a desktop column and a mobile accordion at the same time; the store's swatch pair decides which one a breakpoint shows. See footer-link-group.md.\",\n});\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\n/** A resolved link, ready for both forms. A null `href` is a destination the allowlist refused. */\ntype ResolvedLink = {\n label: string;\n href: PageRef | string | null;\n target: FooterLinkGroupLink['target'];\n};\n\nfunction readLinks(\n content: readonly FooterLinkGroupContentLink[] | undefined,\n authored: readonly FooterLinkGroupLink[] | undefined,\n): readonly FooterLinkGroupLink[] {\n if (content !== undefined) return content;\n return authored ?? [];\n}\n\nfunction resolveDestination(href: PageRef | string, index: number): PageRef | string | null {\n if (typeof href !== 'string') return href;\n\n const destination = resolveSafeHref(href);\n if (!destination.safe) {\n // A bounded reason and no authored value, the convention the content runtime's own log follows.\n console.warn('[FooterLinkGroup] link destination rejected', { index, reason: destination.reason });\n return null;\n }\n return destination.href;\n}\n\n/** Unique within its own root, and every group renders its own root. */\nconst ACCORDION_ITEM_VALUE = 'links';\n\n/**\n * Resolves the whole list once per render, so both forms show the same links and a refused\n * destination logs one line rather than two.\n */\nfunction resolveLinks(links: readonly FooterLinkGroupLink[]): ResolvedLink[] {\n const resolved: ResolvedLink[] = [];\n\n links.forEach((link, index) => {\n // `minLength` is enforced by neither the runtime slice nor the preflight, so a blank label\n // reaches the component. Drop the link: an anchor with no accessible name is a WCAG failure.\n if (link.label.trim().length === 0) {\n return;\n }\n resolved.push({\n label: link.label,\n href: resolveDestination(link.href, index),\n target: link.target,\n });\n });\n\n return resolved;\n}\n\nexport function FooterLinkGroup({ heading, links, $content, className, ...props }: FooterLinkGroupProps) {\n const groupHeading = $content?.heading ?? heading;\n // An entry supplying `links: []` beats an authored prop: a merchant who cleared the list cleared it.\n const resolved = resolveLinks(readLinks($content?.links, links));\n\n if (!groupHeading?.trim() || resolved.length === 0) {\n return null;\n }\n\n // One element rendered in both forms, so the two cannot drift.\n const list = (\n <ul data-fs-footer-link-group-list=\"\">\n {resolved.map((link, index) => (\n <li key={index} data-fs-footer-link-group-item=\"\">\n {link.href === null ? (\n <span data-fs-text=\"\" data-fs-footer-link-group-text=\"\">\n {link.label}\n </span>\n ) : (\n <NavigationLink href={link.href} target={link.target} data-fs-footer-link-group-link=\"\">\n {link.label}\n </NavigationLink>\n )}\n </li>\n ))}\n </ul>\n );\n\n return (\n <div {...props} className={className} data-fs-footer-link-group=\"\">\n {/* Base UI makes the root a `region`; an unnamed one repeats once per group. A `group` keeps the\n grouping and adds no landmark. */}\n <AccordionRoot role=\"group\" data-fs-footer-link-group-accordion=\"\">\n <AccordionItem value={ACCORDION_ITEM_VALUE}>\n <AccordionHeader data-fs-footer-link-group-heading=\"\">\n <AccordionTrigger data-fs-text=\"\" data-fs-footer-link-group-trigger=\"\">\n {groupHeading}\n </AccordionTrigger>\n </AccordionHeader>\n {/* `hiddenUntilFound` requires the panel to stay mounted while closed, and the wrapper\n defaults `keepMounted` to false, so passing it keeps Base UI from warning about the pair. */}\n <AccordionPanel hiddenUntilFound keepMounted data-fs-footer-link-group-panel=\"\">\n {list}\n </AccordionPanel>\n </AccordionItem>\n </AccordionRoot>\n <div data-fs-footer-link-group-column=\"\">\n <h3 data-fs-text=\"\" data-fs-footer-link-group-heading=\"\">\n {groupHeading}\n </h3>\n {list}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAiBA,MAAa,yBAAyB,kBAAkB;CACtD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAA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 @@
|
|
|
1
|
+
import { ContentValue, MessageLocaleProp } from "../../core/dist/define-content-type.js";
|
|
1
2
|
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
3
|
import "../../core/dist/index.js";
|
|
3
4
|
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
@@ -24,7 +25,8 @@ export type FieldsetRegistration = Readonly<{
|
|
|
24
25
|
* Must settle: the form gives up on a dispatch still pending after `FORM_DISPATCH_TIMEOUT_MS` and
|
|
25
26
|
* reports it as a failed write. Must also be idempotent: giving up on a dispatch does not cancel it,
|
|
26
27
|
* so a timed-out write may already be landing on the server, and the same payload is re-dispatched on
|
|
27
|
-
* the shopper's next submit while the field stays dirty.
|
|
28
|
+
* the shopper's next submit while the field stays dirty. Each resolved error's `message` is already
|
|
29
|
+
* worded from the fieldset's own `$content`, keyed on its `code`: `FormError` renders it as is.
|
|
28
30
|
*/
|
|
29
31
|
dispatch: (payload: Record<string, unknown>) => Promise<readonly FormUserError[]>;
|
|
30
32
|
/** Shapes react-hook-form's raw values into the mutation's payload, including type coercion. */
|
|
@@ -32,7 +34,8 @@ export type FieldsetRegistration = Readonly<{
|
|
|
32
34
|
/**
|
|
33
35
|
* Machine identifier for this fieldset's write. `FormError` renders it as the
|
|
34
36
|
* `data-fs-form-error-item` attribute value and uses it in two React keys; it is never displayed,
|
|
35
|
-
* because the visible text is each `userError`'s
|
|
37
|
+
* because the visible text is each `userError`'s `message` (the fieldset's own copy) or `FormError`'s
|
|
38
|
+
* `fallbackMessage`.
|
|
36
39
|
* Its value is the kebab-case ASCII rendering of this registration's own `namespace`
|
|
37
40
|
* (`shippingAddress` → `shipping-address`), so a stylesheet selecting
|
|
38
41
|
* `[data-fs-form-error-item="…"]` needs one predictable shape and no diacritics.
|
|
@@ -56,30 +59,99 @@ export type FormRegistry = Readonly<{
|
|
|
56
59
|
/** Throws when no FormRoot is above the caller. */
|
|
57
60
|
export declare function useFormRegistry(): FormRegistry;
|
|
58
61
|
export type FormRootProps = Omit<ComponentPropsWithRef<'form'>, 'onSubmit' | 'action' | 'method' | 'target' | 'encType' | 'dangerouslySetInnerHTML'>;
|
|
59
|
-
export type FormSubmitProps = {
|
|
62
|
+
export type FormSubmitProps = MessageLocaleProp & {
|
|
63
|
+
$content?: ContentValue<typeof FormSubmitContent>;
|
|
60
64
|
className?: string;
|
|
61
|
-
label?: string;
|
|
62
65
|
children?: ReactNode;
|
|
63
66
|
};
|
|
64
|
-
export type FormClearProps = {
|
|
67
|
+
export type FormClearProps = MessageLocaleProp & {
|
|
68
|
+
$content?: ContentValue<typeof FormClearContent>;
|
|
65
69
|
className?: string;
|
|
66
|
-
label?: string;
|
|
67
70
|
children?: ReactNode;
|
|
68
71
|
};
|
|
69
|
-
export type FormResetProps = {
|
|
72
|
+
export type FormResetProps = MessageLocaleProp & {
|
|
73
|
+
$content?: ContentValue<typeof FormResetContent>;
|
|
70
74
|
className?: string;
|
|
71
|
-
label?: string;
|
|
72
75
|
children?: ReactNode;
|
|
73
76
|
};
|
|
74
|
-
export type FormErrorProps = {
|
|
77
|
+
export type FormErrorProps = MessageLocaleProp & {
|
|
78
|
+
/** The message shown for a fieldset whose write rejected rather than resolving with userErrors. */
|
|
79
|
+
$content?: ContentValue<typeof FormErrorContent>;
|
|
75
80
|
className?: string;
|
|
76
|
-
fallbackMessage?: string;
|
|
77
81
|
};
|
|
78
82
|
export declare const FormRootDefinition: ComponentDefinition<FormRootProps>;
|
|
83
|
+
export declare const FormSubmitContent: {
|
|
84
|
+
readonly id: "form-submit";
|
|
85
|
+
readonly title: "Form Submit";
|
|
86
|
+
readonly description: "Label of the button that submits the form.";
|
|
87
|
+
readonly schema: {
|
|
88
|
+
readonly type: "object";
|
|
89
|
+
readonly additionalProperties: false;
|
|
90
|
+
readonly properties: {
|
|
91
|
+
readonly label: {
|
|
92
|
+
readonly type: "string";
|
|
93
|
+
readonly title: "Label";
|
|
94
|
+
readonly format: "icu-message";
|
|
95
|
+
readonly messageSource: "Continue";
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
79
100
|
export declare const FormSubmitDefinition: ComponentDefinition<FormSubmitProps>;
|
|
80
101
|
export declare const FormEnterSubmitDefinition: ComponentDefinition<FormSubmitProps>;
|
|
102
|
+
export declare const FormErrorContent: {
|
|
103
|
+
readonly id: "form-error";
|
|
104
|
+
readonly title: "Form Error";
|
|
105
|
+
readonly description: "Message shown for a fieldset whose write failed without saying why.";
|
|
106
|
+
readonly schema: {
|
|
107
|
+
readonly type: "object";
|
|
108
|
+
readonly additionalProperties: false;
|
|
109
|
+
readonly properties: {
|
|
110
|
+
readonly fallbackMessage: {
|
|
111
|
+
readonly type: "string";
|
|
112
|
+
readonly title: "Fallback message";
|
|
113
|
+
readonly format: "icu-message";
|
|
114
|
+
readonly messageSource: "Something went wrong. Please try again.";
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
81
119
|
export declare const FormErrorDefinition: ComponentDefinition<FormErrorProps>;
|
|
120
|
+
export declare const FormClearContent: {
|
|
121
|
+
readonly id: "form-clear";
|
|
122
|
+
readonly title: "Form Clear";
|
|
123
|
+
readonly description: "Label of the button that empties the form's fields.";
|
|
124
|
+
readonly schema: {
|
|
125
|
+
readonly type: "object";
|
|
126
|
+
readonly additionalProperties: false;
|
|
127
|
+
readonly properties: {
|
|
128
|
+
readonly label: {
|
|
129
|
+
readonly type: "string";
|
|
130
|
+
readonly title: "Label";
|
|
131
|
+
readonly format: "icu-message";
|
|
132
|
+
readonly messageSource: "Clear";
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
};
|
|
82
137
|
export declare const FormClearDefinition: ComponentDefinition<FormClearProps>;
|
|
138
|
+
export declare const FormResetContent: {
|
|
139
|
+
readonly id: "form-reset";
|
|
140
|
+
readonly title: "Form Reset";
|
|
141
|
+
readonly description: "Label of the button that returns the form's fields to their baseline.";
|
|
142
|
+
readonly schema: {
|
|
143
|
+
readonly type: "object";
|
|
144
|
+
readonly additionalProperties: false;
|
|
145
|
+
readonly properties: {
|
|
146
|
+
readonly label: {
|
|
147
|
+
readonly type: "string";
|
|
148
|
+
readonly title: "Label";
|
|
149
|
+
readonly format: "icu-message";
|
|
150
|
+
readonly messageSource: "Reset";
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
83
155
|
export declare const FormResetDefinition: ComponentDefinition<FormResetProps>;
|
|
84
156
|
export declare function FormRoot({ className, children, onKeyDown, ...props }: FormRootProps): ReactNode;
|
|
85
157
|
export declare function FormSubmit(props: FormSubmitProps): ReactNode;
|
|
@@ -89,9 +161,9 @@ export declare function FormSubmit(props: FormSubmitProps): ReactNode;
|
|
|
89
161
|
* the IME carve-out.
|
|
90
162
|
*/
|
|
91
163
|
export declare function FormEnterSubmit(props: FormSubmitProps): ReactNode;
|
|
92
|
-
export declare function FormError({
|
|
93
|
-
export declare function FormClear({
|
|
94
|
-
export declare function FormReset({
|
|
164
|
+
export declare function FormError({ $content, className }: FormErrorProps): ReactNode;
|
|
165
|
+
export declare function FormClear({ $content, className, children }: Readonly<FormClearProps>): ReactNode;
|
|
166
|
+
export declare function FormReset({ $content, className, children }: Readonly<FormResetProps>): ReactNode;
|
|
95
167
|
export declare const Form: {
|
|
96
168
|
Root: typeof FormRoot;
|
|
97
169
|
Submit: typeof FormSubmit;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import { defineContentType } from "../../core/dist/define-content-type.js";
|
|
3
4
|
import "../../core/dist/index.js";
|
|
4
|
-
import {
|
|
5
|
+
import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
|
|
5
6
|
import { clearBoundField } from "../field/bound-field-registry.js";
|
|
6
7
|
import { Button } from "../button/button.js";
|
|
7
8
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -152,80 +153,130 @@ const FormRootDefinition = defineComponent({
|
|
|
152
153
|
schema: {},
|
|
153
154
|
guideline: "The only <form> its own fieldset registry dispatches from — a composed CartCouponForm, ShippingSimulatorForm or RegionForm renders its own, and a submit-origin check keeps theirs out of this one. Calls react-hook-form's useForm() once and holds the registry a submit dispatches in registration order. Compose FormSubmit/FormEnterSubmit/FormError/FormClear/FormReset anywhere inside it, and a fieldset as a descendant to give the submit something to persist — FormRoot itself declares no actions."
|
|
154
155
|
});
|
|
156
|
+
const FormSubmitContent = defineContentType({
|
|
157
|
+
id: "form-submit",
|
|
158
|
+
title: "Form Submit",
|
|
159
|
+
description: "Label of the button that submits the form.",
|
|
160
|
+
schema: {
|
|
161
|
+
type: "object",
|
|
162
|
+
additionalProperties: false,
|
|
163
|
+
properties: { label: {
|
|
164
|
+
type: "string",
|
|
165
|
+
title: "Label",
|
|
166
|
+
format: "icu-message",
|
|
167
|
+
messageSource: "Continue"
|
|
168
|
+
} }
|
|
169
|
+
}
|
|
170
|
+
});
|
|
155
171
|
const FormSubmitDefinition = defineComponent({
|
|
156
172
|
name: "FormSubmit",
|
|
157
173
|
importPath: "@vtex/faststore/components",
|
|
158
174
|
component: FormSubmit,
|
|
175
|
+
content: FormSubmitContent,
|
|
159
176
|
requiresContext: "form",
|
|
160
177
|
editor: {
|
|
161
178
|
label: "Form Submit",
|
|
162
179
|
category: "action"
|
|
163
180
|
},
|
|
164
|
-
schema: {
|
|
165
|
-
|
|
166
|
-
label: "Label"
|
|
167
|
-
} },
|
|
168
|
-
guideline: "Submits every registered fieldset the shopper changed, in registration order, and disables itself while a write is in flight. Renders children, then label, then the message catalog (fs/form.submit) — never a hard-coded English default. A fieldset with nothing changed contributes no request; an invalid field blocks every dispatch and moves focus to it instead of submitting. Enter in a text input does not submit — see FormEnterSubmit for a form where it does."
|
|
181
|
+
schema: {},
|
|
182
|
+
guideline: "Submits every registered fieldset the shopper changed, in registration order, and disables itself while a write is in flight. Renders children, else its label message. A fieldset with nothing changed contributes no request; an invalid field blocks every dispatch and moves focus to it instead of submitting. Enter in a text input does not submit — see FormEnterSubmit for a form where it does."
|
|
169
183
|
});
|
|
170
184
|
const FormEnterSubmitDefinition = defineComponent({
|
|
171
185
|
name: "FormEnterSubmit",
|
|
172
186
|
importPath: "@vtex/faststore/components",
|
|
173
187
|
component: FormEnterSubmit,
|
|
188
|
+
content: FormSubmitContent,
|
|
174
189
|
requiresContext: "form",
|
|
175
190
|
editor: {
|
|
176
191
|
label: "Form Enter Submit",
|
|
177
192
|
category: "action"
|
|
178
193
|
},
|
|
179
|
-
schema: {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
194
|
+
schema: {},
|
|
195
|
+
guideline: "Renders the same button as FormSubmit, sharing its content type (form-submit) and children, and additionally allows Enter to submit this form from any text-entry input while mounted. The allowance is form-scoped: placed inside one fieldset of a multi-fieldset FormRoot, it allows Enter for every text input in the enclosing form, not only that fieldset. Enter that commits an IME candidate never submits."
|
|
196
|
+
});
|
|
197
|
+
const FormErrorContent = defineContentType({
|
|
198
|
+
id: "form-error",
|
|
199
|
+
title: "Form Error",
|
|
200
|
+
description: "Message shown for a fieldset whose write failed without saying why.",
|
|
201
|
+
schema: {
|
|
202
|
+
type: "object",
|
|
203
|
+
additionalProperties: false,
|
|
204
|
+
properties: { fallbackMessage: {
|
|
205
|
+
type: "string",
|
|
206
|
+
title: "Fallback message",
|
|
207
|
+
format: "icu-message",
|
|
208
|
+
messageSource: "Something went wrong. Please try again."
|
|
209
|
+
} }
|
|
210
|
+
}
|
|
184
211
|
});
|
|
185
212
|
const FormErrorDefinition = defineComponent({
|
|
186
213
|
name: "FormError",
|
|
187
214
|
importPath: "@vtex/faststore/components",
|
|
188
215
|
component: FormError,
|
|
216
|
+
content: FormErrorContent,
|
|
189
217
|
requiresContext: "form",
|
|
190
218
|
editor: {
|
|
191
219
|
label: "Form Error",
|
|
192
220
|
category: "content"
|
|
193
221
|
},
|
|
194
|
-
schema: {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
222
|
+
schema: {},
|
|
223
|
+
guideline: "Renders the last submit's write failures grouped by fieldset, or nothing when there were none. The messages are the fieldsets' own copy: each fieldset words its refusals from its own $content, keyed on the error code. A fieldset whose write rejected rather than resolving with userErrors shows the fallbackMessage message."
|
|
224
|
+
});
|
|
225
|
+
const FormClearContent = defineContentType({
|
|
226
|
+
id: "form-clear",
|
|
227
|
+
title: "Form Clear",
|
|
228
|
+
description: "Label of the button that empties the form's fields.",
|
|
229
|
+
schema: {
|
|
230
|
+
type: "object",
|
|
231
|
+
additionalProperties: false,
|
|
232
|
+
properties: { label: {
|
|
233
|
+
type: "string",
|
|
234
|
+
title: "Label",
|
|
235
|
+
format: "icu-message",
|
|
236
|
+
messageSource: "Clear"
|
|
237
|
+
} }
|
|
238
|
+
}
|
|
199
239
|
});
|
|
200
240
|
const FormClearDefinition = defineComponent({
|
|
201
241
|
name: "FormClear",
|
|
202
242
|
importPath: "@vtex/faststore/components",
|
|
203
243
|
component: FormClear,
|
|
244
|
+
content: FormClearContent,
|
|
204
245
|
requiresContext: "form",
|
|
205
246
|
editor: {
|
|
206
247
|
label: "Form Clear",
|
|
207
248
|
category: "action"
|
|
208
249
|
},
|
|
209
|
-
schema: {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
250
|
+
schema: {},
|
|
251
|
+
guideline: "Empties every field registered by every fieldset inside the enclosing FormRoot, not only the nearest one, but marks dirty only the fields whose value actually changed — a field already empty stays clean. Renders children, else its label message. The following submit dispatches a write for every fieldset that had something to clear, and nothing for one where clearing was a no-op. There is no way to scope it to a single fieldset; place it only where clearing the whole form is the intended action, not by analogy with a per-field clear."
|
|
252
|
+
});
|
|
253
|
+
const FormResetContent = defineContentType({
|
|
254
|
+
id: "form-reset",
|
|
255
|
+
title: "Form Reset",
|
|
256
|
+
description: "Label of the button that returns the form's fields to their baseline.",
|
|
257
|
+
schema: {
|
|
258
|
+
type: "object",
|
|
259
|
+
additionalProperties: false,
|
|
260
|
+
properties: { label: {
|
|
261
|
+
type: "string",
|
|
262
|
+
title: "Label",
|
|
263
|
+
format: "icu-message",
|
|
264
|
+
messageSource: "Reset"
|
|
265
|
+
} }
|
|
266
|
+
}
|
|
214
267
|
});
|
|
215
268
|
const FormResetDefinition = defineComponent({
|
|
216
269
|
name: "FormReset",
|
|
217
270
|
importPath: "@vtex/faststore/components",
|
|
218
271
|
component: FormReset,
|
|
272
|
+
content: FormResetContent,
|
|
219
273
|
requiresContext: "form",
|
|
220
274
|
editor: {
|
|
221
275
|
label: "Form Reset",
|
|
222
276
|
category: "action"
|
|
223
277
|
},
|
|
224
|
-
schema: {
|
|
225
|
-
|
|
226
|
-
label: "Label"
|
|
227
|
-
} },
|
|
228
|
-
guideline: "Returns every registered field to react-hook-form's baseline for that name and clears its dirty/touched state. Renders children, then label, then the message catalog (fs/form.reset). Before a fieldset's first successful write, that baseline is whatever the field's own seed resolves to — not empty — so Reset reverts to the original value rather than clearing it; only after a successful submit does the baseline become what was last written."
|
|
278
|
+
schema: {},
|
|
279
|
+
guideline: "Returns every registered field to react-hook-form's baseline for that name and clears its dirty/touched state. Renders children, else its label message. Before a fieldset's first successful write, that baseline is whatever the field's own seed resolves to — not empty — so Reset reverts to the original value rather than clearing it; only after a successful submit does the baseline become what was last written."
|
|
229
280
|
});
|
|
230
281
|
function FormRoot({ className, children, onKeyDown, ...props }) {
|
|
231
282
|
const form = useForm();
|
|
@@ -397,21 +448,18 @@ function FormRoot({ className, children, onKeyDown, ...props }) {
|
|
|
397
448
|
}
|
|
398
449
|
/**
|
|
399
450
|
* The shared render for both submit parts: same button, same hooks, same data-fs-form-submit hook.
|
|
400
|
-
*
|
|
401
|
-
* default — so an unauthored FormEnterSubmit reads correctly in every shipped locale, not only
|
|
402
|
-
* en-US. One id, `fs/form.submit`, covers both parts: they render the same button, so a second id
|
|
403
|
-
* for the Enter variant would only be a second translation of the same word.
|
|
451
|
+
* Both read the `form-submit` content type: they render the same button.
|
|
404
452
|
*/
|
|
405
|
-
function SubmitButton({
|
|
453
|
+
function SubmitButton({ $content, className, children }) {
|
|
406
454
|
const { isSubmitting } = useFormState();
|
|
407
|
-
const
|
|
455
|
+
const { format } = useMessageFormatter(FormSubmitContent, $content);
|
|
408
456
|
return /* @__PURE__ */ jsx(Button, {
|
|
409
457
|
type: "submit",
|
|
410
458
|
disabled: isSubmitting,
|
|
411
459
|
className,
|
|
412
460
|
"data-fs-form-submit": "",
|
|
413
461
|
"data-fs-form-submit-pending": isSubmitting ? "" : void 0,
|
|
414
|
-
children: children ??
|
|
462
|
+
children: children ?? format("label")
|
|
415
463
|
});
|
|
416
464
|
}
|
|
417
465
|
function FormSubmit(props) {
|
|
@@ -428,8 +476,9 @@ function FormEnterSubmit(props) {
|
|
|
428
476
|
useAllowImplicitSubmission();
|
|
429
477
|
return /* @__PURE__ */ jsx(SubmitButton, { ...props });
|
|
430
478
|
}
|
|
431
|
-
function FormError({
|
|
479
|
+
function FormError({ $content, className }) {
|
|
432
480
|
const { failures } = useFormRegistry();
|
|
481
|
+
const { format } = useMessageFormatter(FormErrorContent, $content);
|
|
433
482
|
if (failures.length === 0) return null;
|
|
434
483
|
return /* @__PURE__ */ jsx("div", {
|
|
435
484
|
role: "alert",
|
|
@@ -437,14 +486,14 @@ function FormError({ className, fallbackMessage = "Something went wrong. Please
|
|
|
437
486
|
"data-fs-form-error": "",
|
|
438
487
|
children: failures.map((failure, failureIndex) => /* @__PURE__ */ jsx("ul", {
|
|
439
488
|
"data-fs-form-error-item": failure.label,
|
|
440
|
-
children: failure.userErrors.length > 0 ? failure.userErrors.map((error, errorIndex) => /* @__PURE__ */ jsx("li", { children: error.message }, `${failure.label}-${failureIndex}-${errorIndex}`)) : /* @__PURE__ */ jsx("li", { children: fallbackMessage })
|
|
489
|
+
children: failure.userErrors.length > 0 ? failure.userErrors.map((error, errorIndex) => /* @__PURE__ */ jsx("li", { children: error.message }, `${failure.label}-${failureIndex}-${errorIndex}`)) : /* @__PURE__ */ jsx("li", { children: format("fallbackMessage") })
|
|
441
490
|
}, `${failure.label}-${failureIndex}`))
|
|
442
491
|
});
|
|
443
492
|
}
|
|
444
|
-
function FormClear({
|
|
493
|
+
function FormClear({ $content, className, children }) {
|
|
445
494
|
const getFieldsets = useFieldsetSnapshot();
|
|
446
495
|
const { control } = useFormContext();
|
|
447
|
-
const
|
|
496
|
+
const { format } = useMessageFormatter(FormClearContent, $content);
|
|
448
497
|
function handleClear() {
|
|
449
498
|
for (const fieldset of getFieldsets()) for (const name of fieldset.getFieldNames()) clearBoundField(control, name);
|
|
450
499
|
}
|
|
@@ -453,13 +502,13 @@ function FormClear({ className, label, children }) {
|
|
|
453
502
|
onClick: handleClear,
|
|
454
503
|
className,
|
|
455
504
|
"data-fs-form-clear": "",
|
|
456
|
-
children: children ??
|
|
505
|
+
children: children ?? format("label")
|
|
457
506
|
});
|
|
458
507
|
}
|
|
459
|
-
function FormReset({
|
|
508
|
+
function FormReset({ $content, className, children }) {
|
|
460
509
|
const getFieldsets = useFieldsetSnapshot();
|
|
461
510
|
const { resetField } = useFormContext();
|
|
462
|
-
const
|
|
511
|
+
const { format } = useMessageFormatter(FormResetContent, $content);
|
|
463
512
|
function handleReset() {
|
|
464
513
|
for (const fieldset of getFieldsets()) for (const name of fieldset.getFieldNames()) resetField(name);
|
|
465
514
|
}
|
|
@@ -468,7 +517,7 @@ function FormReset({ className, label, children }) {
|
|
|
468
517
|
onClick: handleReset,
|
|
469
518
|
className,
|
|
470
519
|
"data-fs-form-reset": "",
|
|
471
|
-
children: children ??
|
|
520
|
+
children: children ?? format("label")
|
|
472
521
|
});
|
|
473
522
|
}
|
|
474
523
|
const Form = {
|
|
@@ -480,6 +529,6 @@ const Form = {
|
|
|
480
529
|
Reset: FormReset
|
|
481
530
|
};
|
|
482
531
|
//#endregion
|
|
483
|
-
export { FORM_DISPATCH_TIMEOUT_MS, Form, FormClear, FormClearDefinition, FormEnterSubmit, FormEnterSubmitDefinition, FormError, FormErrorDefinition, FormRegistryContext, FormReset, FormResetDefinition, FormRoot, FormRootDefinition, FormSubmit, FormSubmitDefinition, useFormRegistry };
|
|
532
|
+
export { FORM_DISPATCH_TIMEOUT_MS, Form, FormClear, FormClearContent, FormClearDefinition, FormEnterSubmit, FormEnterSubmitDefinition, FormError, FormErrorContent, FormErrorDefinition, FormRegistryContext, FormReset, FormResetContent, FormResetDefinition, FormRoot, FormRootDefinition, FormSubmit, FormSubmitContent, FormSubmitDefinition, useFormRegistry };
|
|
484
533
|
|
|
485
534
|
//# sourceMappingURL=form.js.map
|