@vtex/faststore 0.0.6 → 0.0.8
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 +99 -0
- package/dist/actions.json +152 -1
- package/dist/catalog.json +2541 -1278
- package/dist/cli/UnreachableCaseError-Crd168Vu.js +10 -0
- package/dist/cli/UnreachableCaseError-Crd168Vu.js.map +1 -0
- package/dist/cli/cacheControl-CEojH_TM.js +158 -0
- package/dist/cli/cacheControl-CEojH_TM.js.map +1 -0
- package/dist/cli/cachePolicy-m2vASMRW.js +26 -0
- package/dist/cli/cachePolicy-m2vASMRW.js.map +1 -0
- package/dist/cli/computeCoreSchemaHash-DPJZj-qJ.js +10 -0
- package/dist/cli/computeCoreSchemaHash-DPJZj-qJ.js.map +1 -0
- package/dist/cli/default-BCQHcwbL.js +253 -0
- package/dist/cli/default-BCQHcwbL.js.map +1 -0
- package/dist/cli/disableSuggestions-yO9UqiWn.js +21 -0
- package/dist/cli/disableSuggestions-yO9UqiWn.js.map +1 -0
- package/dist/cli/dist-C1JhdHfo.js +2001 -0
- package/dist/cli/dist-C1JhdHfo.js.map +1 -0
- package/dist/cli/graphql-DG9thCDG.js +14589 -0
- package/dist/cli/graphql-DG9thCDG.js.map +1 -0
- package/dist/cli/index.d.ts +799 -0
- package/dist/cli/index.js +36459 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.min-BsIHDfFK.js +613 -0
- package/dist/cli/index.min-BsIHDfFK.js.map +1 -0
- package/dist/cli/inlineTrace-uLgOJ3TH.js +52 -0
- package/dist/cli/inlineTrace-uLgOJ3TH.js.map +1 -0
- package/dist/cli/internalPlugin-DnuwN4_4.js +11 -0
- package/dist/cli/internalPlugin-DnuwN4_4.js.map +1 -0
- package/dist/cli/packageVersion-DQAnIEil.js +6 -0
- package/dist/cli/packageVersion-DQAnIEil.js.map +1 -0
- package/dist/cli/rolldown-runtime-BMI-E3GI.js +44 -0
- package/dist/cli/schemaIsSubgraph-DoGh3OYj.js +17 -0
- package/dist/cli/schemaIsSubgraph-DoGh3OYj.js.map +1 -0
- package/dist/cli/schemaReporting-K-me-3-v.js +199 -0
- package/dist/cli/schemaReporting-K-me-3-v.js.map +1 -0
- package/dist/cli/server-runtime.js +49879 -0
- package/dist/cli/server-runtime.js.map +1 -0
- package/dist/cli/traceTreeBuilder-BIcV2U7b.js +9118 -0
- package/dist/cli/traceTreeBuilder-BIcV2U7b.js.map +1 -0
- package/dist/cli/usageReporting-Bpl8vSZX.js +10201 -0
- package/dist/cli/usageReporting-Bpl8vSZX.js.map +1 -0
- package/dist/cli/v4-CBhFvC49.js +42 -0
- package/dist/cli/v4-CBhFvC49.js.map +1 -0
- package/dist/client.d.ts +5 -1
- package/dist/client.js +5 -1
- package/dist/components.d.ts +38 -9
- package/dist/components.js +42 -13
- package/dist/content-types.json +616 -0
- package/dist/core/dist/define-component.d.ts +43 -1
- package/dist/core/dist/index.d.ts +2 -2
- package/dist/docs/account-access-gate.md +4 -4
- package/dist/docs/account-address-book.md +519 -0
- package/dist/docs/account-entry-point.md +1 -1
- package/dist/docs/account-menu-identity.md +160 -0
- package/dist/docs/account-menu.md +107 -24
- package/dist/docs/alert-dialog.md +2 -2
- package/dist/docs/avatar.md +103 -0
- package/dist/docs/billing-address.md +17 -9
- package/dist/docs/card-entry.md +37 -6
- package/dist/docs/cardholder-document.md +16 -14
- package/dist/docs/cart-item.md +1 -1
- package/dist/docs/cart.md +8 -8
- package/dist/docs/client-profile-fieldset.md +7 -5
- package/dist/docs/copy-text.md +84 -0
- package/dist/docs/document-field.md +8 -8
- package/dist/docs/footer-link-group.md +2 -2
- package/dist/docs/header-root.md +1 -1
- package/dist/docs/incentives.md +2 -2
- package/dist/docs/logo.md +5 -5
- package/dist/docs/my-account-profile.md +5 -5
- package/dist/docs/navigation-link-list.md +2 -2
- package/dist/docs/navigation-link.md +3 -3
- package/dist/docs/order-cancel.md +52 -0
- package/dist/docs/order-delivery-address.md +63 -0
- package/dist/docs/order-delivery-group.md +83 -0
- package/dist/docs/order-details-back.md +41 -0
- package/dist/docs/order-details-header.md +48 -0
- package/dist/docs/order-list-row.md +46 -0
- package/dist/docs/order-list-search.md +101 -0
- package/dist/docs/order-list-views.md +97 -0
- package/dist/docs/order-list.md +94 -0
- package/dist/docs/order-payment.md +94 -0
- package/dist/docs/order-placed-date.md +49 -0
- package/dist/docs/order-placed-payment-summary.md +13 -15
- package/dist/docs/order-placed.md +225 -0
- package/dist/docs/order-progress.md +88 -0
- package/dist/docs/order-status-badge.md +91 -0
- package/dist/docs/order-summary.md +53 -0
- package/dist/docs/payment-method-badges.md +14 -3
- package/dist/docs/place-order.md +13 -9
- package/dist/docs/product-shelf.md +20 -13
- package/dist/docs/saved-cards.md +2 -2
- package/dist/docs/select.md +19 -6
- package/dist/docs/session.md +1 -1
- package/dist/docs/shipping-address.md +1 -1
- package/dist/docs/sign-in-redirect.md +6 -6
- package/dist/docs/toast.md +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +2 -1
- package/dist/internal/client.d.ts +6 -1
- package/dist/internal/client.js +8 -3
- package/dist/internal/content.d.ts +2 -2
- package/dist/internal/server.d.ts +8 -1
- package/dist/internal/server.js +8 -1
- package/dist/matter/account-access-gate/account-access-gate.d.ts +2 -1
- package/dist/matter/account-access-gate/account-access-gate.js +19 -16
- package/dist/matter/account-access-gate/account-access-gate.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-delete.d.ts +60 -0
- package/dist/matter/account-address-book/account-address-book-delete.js +184 -0
- package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -0
- package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +19 -0
- package/dist/matter/account-address-book/account-address-book-deliverability.js +50 -0
- package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -0
- package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +42 -0
- package/dist/matter/account-address-book/account-address-book-form-parts.js +146 -0
- package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -0
- package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +25 -0
- package/dist/matter/account-address-book/account-address-book-profile-notice.js +72 -0
- package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -0
- package/dist/matter/account-address-book/account-address-book.d.ts +120 -0
- package/dist/matter/account-address-book/account-address-book.js +469 -0
- package/dist/matter/account-address-book/account-address-book.js.map +1 -0
- package/dist/matter/account-address-book/account-address-country-switch.js +59 -0
- package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -0
- package/dist/matter/account-address-book/account-address-country.d.ts +36 -0
- package/dist/matter/account-address-book/account-address-country.js +151 -0
- package/dist/matter/account-address-book/account-address-country.js.map +1 -0
- package/dist/matter/account-address-book/account-address-first-line.js +11 -0
- package/dist/matter/account-address-book/account-address-first-line.js.map +1 -0
- package/dist/matter/account-address-book/account-address-form-context.d.ts +55 -0
- package/dist/matter/account-address-book/account-address-form-context.js +14 -0
- package/dist/matter/account-address-book/account-address-form-context.js.map +1 -0
- package/dist/matter/account-address-book/account-address-form.d.ts +85 -0
- package/dist/matter/account-address-book/account-address-form.js +946 -0
- package/dist/matter/account-address-book/account-address-form.js.map +1 -0
- package/dist/matter/account-address-book/account-address-postal-autofill.js +189 -0
- package/dist/matter/account-address-book/account-address-postal-autofill.js.map +1 -0
- package/dist/matter/account-address-book/account-address-record.d.ts +26 -0
- package/dist/matter/account-address-book/account-address-record.js +138 -0
- package/dist/matter/account-address-book/account-address-record.js.map +1 -0
- package/dist/matter/account-entry-point/account-entry-point.js +11 -11
- package/dist/matter/account-entry-point/account-entry-point.js.map +1 -1
- package/dist/matter/account-menu/account-menu.d.ts +77 -3
- package/dist/matter/account-menu/account-menu.js +252 -19
- package/dist/matter/account-menu/account-menu.js.map +1 -1
- package/dist/matter/account-menu/sign-out-failure.js +50 -0
- package/dist/matter/account-menu/sign-out-failure.js.map +1 -0
- package/dist/matter/account-menu-identity/account-menu-identity.d.ts +21 -0
- package/dist/matter/account-menu-identity/account-menu-identity.js +88 -0
- package/dist/matter/account-menu-identity/account-menu-identity.js.map +1 -0
- package/dist/matter/billing-address/billing-address.d.ts +30 -17
- package/dist/matter/billing-address/billing-address.js +128 -33
- package/dist/matter/billing-address/billing-address.js.map +1 -1
- package/dist/matter/breadcrumb/breadcrumb.js +2 -2
- package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/matter/card-entry/card-capture.js +4 -3
- package/dist/matter/card-entry/card-capture.js.map +1 -1
- package/dist/matter/card-entry/card-entry.d.ts +5 -3
- package/dist/matter/card-entry/card-entry.js +78 -27
- package/dist/matter/card-entry/card-entry.js.map +1 -1
- package/dist/matter/cardholder-document/cardholder-document.d.ts +10 -9
- package/dist/matter/cardholder-document/cardholder-document.js +36 -16
- package/dist/matter/cardholder-document/cardholder-document.js.map +1 -1
- package/dist/matter/cart/cart.d.ts +7 -2
- package/dist/matter/cart/cart.js +29 -26
- package/dist/matter/cart/cart.js.map +1 -1
- package/dist/matter/cart-item/cart-item.js +2 -2
- package/dist/matter/cart-item/cart-item.js.map +1 -1
- package/dist/matter/client-preferences/client-preferences-fieldset.js +2 -2
- package/dist/matter/client-profile-form/client-profile-fieldset.js +9 -6
- package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
- package/dist/matter/identity-edit/identity-edit.js +3 -3
- package/dist/matter/identity-edit/identity-edit.js.map +1 -1
- package/dist/matter/identity-summary/identity-summary.js +4 -3
- package/dist/matter/identity-summary/identity-summary.js.map +1 -1
- package/dist/matter/my-account-profile/my-account-profile.d.ts +6 -3
- package/dist/matter/my-account-profile/my-account-profile.js +6 -5
- package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
- package/dist/matter/order-cancel/order-cancel.d.ts +110 -0
- package/dist/matter/order-cancel/order-cancel.js +344 -0
- package/dist/matter/order-cancel/order-cancel.js.map +1 -0
- package/dist/matter/order-delivery-address/order-delivery-address.d.ts +73 -0
- package/dist/matter/order-delivery-address/order-delivery-address.js +172 -0
- package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -0
- package/dist/matter/order-delivery-group/order-delivery-group.d.ts +128 -0
- package/dist/matter/order-delivery-group/order-delivery-group.js +408 -0
- package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -0
- package/dist/matter/order-details-header/order-details-header.d.ts +104 -0
- package/dist/matter/order-details-header/order-details-header.js +190 -0
- package/dist/matter/order-details-header/order-details-header.js.map +1 -0
- package/dist/matter/order-list/customer-orders-filter.d.ts +12 -0
- package/dist/matter/order-list/customer-orders-filter.js +30 -0
- package/dist/matter/order-list/customer-orders-filter.js.map +1 -0
- package/dist/matter/order-list/order-list.d.ts +121 -0
- package/dist/matter/order-list/order-list.js +395 -0
- package/dist/matter/order-list/order-list.js.map +1 -0
- package/dist/matter/order-list-row/order-list-row.d.ts +44 -0
- package/dist/matter/order-list-row/order-list-row.js +127 -0
- package/dist/matter/order-list-row/order-list-row.js.map +1 -0
- package/dist/matter/order-list-search/order-list-search.d.ts +72 -0
- package/dist/matter/order-list-search/order-list-search.js +296 -0
- package/dist/matter/order-list-search/order-list-search.js.map +1 -0
- package/dist/matter/order-list-views/order-list-views.d.ts +65 -0
- package/dist/matter/order-list-views/order-list-views.js +154 -0
- package/dist/matter/order-list-views/order-list-views.js.map +1 -0
- package/dist/matter/order-payment/order-payment.d.ts +83 -0
- package/dist/matter/order-payment/order-payment.js +258 -0
- package/dist/matter/order-payment/order-payment.js.map +1 -0
- package/dist/matter/order-placed/order-placed-deliveries.d.ts +145 -0
- package/dist/matter/order-placed/order-placed-deliveries.js +380 -0
- package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -0
- package/dist/matter/order-placed/order-placed.d.ts +122 -0
- package/dist/matter/order-placed/order-placed.js +452 -0
- package/dist/matter/order-placed/order-placed.js.map +1 -0
- package/dist/matter/order-placed-date/order-placed-date.d.ts +45 -0
- package/dist/matter/order-placed-date/order-placed-date.js +92 -0
- package/dist/matter/order-placed-date/order-placed-date.js.map +1 -0
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +5 -8
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +29 -81
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
- package/dist/matter/order-progress/order-progress.d.ts +85 -0
- package/dist/matter/order-progress/order-progress.js +203 -0
- package/dist/matter/order-progress/order-progress.js.map +1 -0
- package/dist/matter/order-summary/order-summary.d.ts +81 -0
- package/dist/matter/order-summary/order-summary.js +192 -0
- package/dist/matter/order-summary/order-summary.js.map +1 -0
- package/dist/matter/payment/cardholder-document-rule.d.ts +35 -0
- package/dist/matter/payment/cardholder-document-rule.js +35 -0
- package/dist/matter/payment/cardholder-document-rule.js.map +1 -0
- package/dist/matter/payment/payment-card-capture.js +38 -23
- package/dist/matter/payment/payment-card-capture.js.map +1 -1
- package/dist/matter/payment/payment-controller.js +12 -0
- package/dist/matter/payment/payment-controller.js.map +1 -1
- package/dist/matter/payment/payment-method-badges.js +4 -2
- package/dist/matter/payment/payment-method-badges.js.map +1 -1
- package/dist/matter/payment/payment.js +12 -0
- package/dist/matter/payment/payment.js.map +1 -1
- package/dist/matter/payment/use-payment-method-selection.d.ts +39 -0
- package/dist/matter/payment/use-payment-method-selection.js +30 -2
- package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
- package/dist/matter/payment/use-payment-submit-gate.d.ts +16 -2
- package/dist/matter/payment/use-payment-submit-gate.js +42 -14
- package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
- package/dist/matter/place-order/place-order.d.ts +12 -7
- package/dist/matter/place-order/place-order.js +126 -103
- package/dist/matter/place-order/place-order.js.map +1 -1
- package/dist/matter/pricing/pricing.js +5 -5
- package/dist/matter/pricing/pricing.js.map +1 -1
- package/dist/matter/product-shelf/product-shelf.d.ts +61 -31
- package/dist/matter/product-shelf/product-shelf.js +157 -57
- package/dist/matter/product-shelf/product-shelf.js.map +1 -1
- package/dist/matter/region/region.js +1 -1
- package/dist/matter/saved-cards/saved-cards.js +27 -15
- package/dist/matter/saved-cards/saved-cards.js.map +1 -1
- package/dist/matter/session/session.js +2 -2
- package/dist/matter/session/session.js.map +1 -1
- package/dist/matter/shipping-address/country-descriptors.d.ts +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +23 -1
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
- package/dist/matter/shipping-address/shipping-address.js +63 -15
- package/dist/matter/shipping-address/shipping-address.js.map +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.d.ts +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
- package/dist/matter/sign-in-redirect/sign-in-redirect.js +48 -10
- package/dist/matter/sign-in-redirect/sign-in-redirect.js.map +1 -1
- package/dist/matter/variant-selector/variant-selector.js +2 -2
- package/dist/matter/variant-selector/variant-selector.js.map +1 -1
- package/dist/particles/address-summary/address-summary.js +2 -2
- package/dist/particles/address-summary/address-summary.js.map +1 -1
- package/dist/particles/alert-dialog/alert-dialog.d.ts +5 -1
- package/dist/particles/alert-dialog/alert-dialog.js +5 -2
- package/dist/particles/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/particles/avatar/avatar.d.ts +17 -0
- package/dist/particles/avatar/avatar.js +65 -0
- package/dist/particles/avatar/avatar.js.map +1 -0
- package/dist/particles/copy-text/copy-text.d.ts +28 -0
- package/dist/particles/copy-text/copy-text.js +140 -0
- package/dist/particles/copy-text/copy-text.js.map +1 -0
- package/dist/particles/document-field/document-field.d.ts +34 -5
- package/dist/particles/document-field/document-field.js +115 -19
- package/dist/particles/document-field/document-field.js.map +1 -1
- package/dist/particles/field/field.js +1 -1
- package/dist/particles/field/field.js.map +1 -1
- package/dist/particles/footer-link-group/footer-link-group.d.ts +6 -2
- package/dist/particles/footer-link-group/footer-link-group.js +18 -7
- package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
- package/dist/particles/incentives/incentives.d.ts +6 -2
- package/dist/particles/incentives/incentives.js +7 -2
- package/dist/particles/incentives/incentives.js.map +1 -1
- package/dist/particles/logo/logo.d.ts +3 -2
- package/dist/particles/logo/logo.js +20 -8
- package/dist/particles/logo/logo.js.map +1 -1
- package/dist/particles/navigation-link/navigation-link.d.ts +2 -3
- package/dist/particles/navigation-link/navigation-link.js +4 -4
- package/dist/particles/navigation-link/navigation-link.js.map +1 -1
- package/dist/particles/navigation-link-list/navigation-link-list.d.ts +6 -2
- package/dist/particles/navigation-link-list/navigation-link-list.js +18 -7
- package/dist/particles/navigation-link-list/navigation-link-list.js.map +1 -1
- package/dist/particles/order-details-back/order-details-back.d.ts +28 -0
- package/dist/particles/order-details-back/order-details-back.js +52 -0
- package/dist/particles/order-details-back/order-details-back.js.map +1 -0
- package/dist/particles/order-status-badge/order-status-badge.d.ts +19 -0
- package/dist/particles/order-status-badge/order-status-badge.js +50 -0
- package/dist/particles/order-status-badge/order-status-badge.js.map +1 -0
- package/dist/particles/phone-field/phone-field.js +2 -2
- package/dist/particles/phone-field/phone-field.js.map +1 -1
- package/dist/particles/select/select.js +6 -6
- package/dist/particles/select/select.js.map +1 -1
- package/dist/particles/toast/toast.d.ts +1 -1
- package/dist/particles/toast/toast.js +32 -6
- package/dist/particles/toast/toast.js.map +1 -1
- package/dist/schema.graphql +1079 -54
- package/dist/sdk/actions/address-action-provider.d.ts +16 -0
- package/dist/sdk/actions/address-action-provider.js +20 -0
- package/dist/sdk/actions/address-action-provider.js.map +1 -0
- package/dist/sdk/actions/analytics-action-provider.js +1 -1
- package/dist/sdk/actions/index.d.ts +3 -1
- package/dist/sdk/actions/index.js +3 -1
- package/dist/sdk/actions/order-action-provider.d.ts +12 -0
- package/dist/sdk/actions/order-action-provider.js +16 -0
- package/dist/sdk/actions/order-action-provider.js.map +1 -0
- package/dist/sdk/actions/types.d.ts +6 -2
- package/dist/sdk/address/address-fields.js +38 -0
- package/dist/sdk/address/address-fields.js.map +1 -0
- package/dist/sdk/address/checkout-readiness.js +17 -0
- package/dist/sdk/address/checkout-readiness.js.map +1 -0
- package/dist/sdk/address/constants.js +60 -0
- package/dist/sdk/address/constants.js.map +1 -0
- package/dist/sdk/address/country-display.js +19 -0
- package/dist/sdk/address/country-display.js.map +1 -0
- package/dist/sdk/address/country-rules.js +30 -0
- package/dist/sdk/address/country-rules.js.map +1 -0
- package/dist/sdk/address/format-address.js +18 -0
- package/dist/sdk/address/format-address.js.map +1 -0
- package/dist/sdk/address/iso-countries.js +262 -0
- package/dist/sdk/address/iso-countries.js.map +1 -0
- package/dist/sdk/address/layouts.js +56 -0
- package/dist/sdk/address/layouts.js.map +1 -0
- package/dist/sdk/address/messages.js +97 -0
- package/dist/sdk/address/messages.js.map +1 -0
- package/dist/sdk/address/operations.d.ts +54 -0
- package/dist/sdk/address/operations.js +83 -0
- package/dist/sdk/address/operations.js.map +1 -0
- package/dist/sdk/address/postal-code-lookup-operations.js +23 -0
- package/dist/sdk/address/postal-code-lookup-operations.js.map +1 -0
- package/dist/sdk/address/postal-code.js +11 -0
- package/dist/sdk/address/postal-code.js.map +1 -0
- package/dist/sdk/address/schema.js +14 -0
- package/dist/sdk/address/schema.js.map +1 -0
- package/dist/sdk/address/server-fields.js +25 -0
- package/dist/sdk/address/server-fields.js.map +1 -0
- package/dist/sdk/address/switch-country.js +57 -0
- package/dist/sdk/address/switch-country.js.map +1 -0
- package/dist/sdk/address/types.d.ts +26 -0
- package/dist/sdk/address/use-address-actions.d.ts +29 -0
- package/dist/sdk/address/use-address-actions.js +247 -0
- package/dist/sdk/address/use-address-actions.js.map +1 -0
- package/dist/sdk/address/use-address-by-postal-code.js +57 -0
- package/dist/sdk/address/use-address-by-postal-code.js.map +1 -0
- package/dist/sdk/address/validate-address.js +62 -0
- package/dist/sdk/address/validate-address.js.map +1 -0
- package/dist/sdk/analytics/use-analytics-actions.js +2 -1
- package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
- package/dist/sdk/cache/storefront-cache.js +29 -4
- package/dist/sdk/cache/storefront-cache.js.map +1 -1
- package/dist/sdk/cart/use-cart-actions.js +9 -8
- package/dist/sdk/cart/use-cart-actions.js.map +1 -1
- package/dist/sdk/cart/use-cart-validate-on-open.js +2 -1
- package/dist/sdk/cart/use-cart-validate-on-open.js.map +1 -1
- package/dist/sdk/client/fetch-page-data.d.ts +11 -0
- package/dist/sdk/client/fetch-page-data.js +12 -1
- package/dist/sdk/client/fetch-page-data.js.map +1 -1
- package/dist/sdk/content/create-content-runtime.d.ts +22 -1
- package/dist/sdk/content/create-content-runtime.js +90 -9
- package/dist/sdk/content/create-content-runtime.js.map +1 -1
- package/dist/sdk/data/empty-content-value.js +16 -0
- package/dist/sdk/data/empty-content-value.js.map +1 -0
- package/dist/sdk/data/failed-fields.js +23 -0
- package/dist/sdk/data/failed-fields.js.map +1 -0
- package/dist/sdk/data/hot-data-provider.js +2 -1
- package/dist/sdk/data/hot-data-provider.js.map +1 -1
- package/dist/sdk/data/index.js +1 -1
- package/dist/sdk/data/page-reactive-data-root.d.ts +45 -7
- package/dist/sdk/data/page-reactive-data-root.js +88 -12
- package/dist/sdk/data/page-reactive-data-root.js.map +1 -1
- package/dist/sdk/data/variables-from-content.d.ts +43 -0
- package/dist/sdk/data/variables-from-content.js +57 -0
- package/dist/sdk/data/variables-from-content.js.map +1 -0
- package/dist/sdk/generated/fragment-types.js +2 -0
- package/dist/sdk/generated/fragment-types.js.map +1 -1
- package/dist/sdk/generated/gql.js +4 -1
- package/dist/sdk/generated/gql.js.map +1 -1
- package/dist/sdk/generated/graphql.d.ts +8 -0
- package/dist/sdk/generated/graphql.js +296 -1
- package/dist/sdk/generated/graphql.js.map +1 -1
- package/dist/sdk/i18n/messages/en-US.js +138 -1
- package/dist/sdk/i18n/messages/en-US.json +138 -1
- package/dist/sdk/i18n/messages/en-US.json.d.ts +137 -0
- package/dist/sdk/i18n/messages/es-ES.js +138 -1
- package/dist/sdk/i18n/messages/es-ES.json +138 -1
- package/dist/sdk/i18n/messages/pt-BR.js +138 -1
- package/dist/sdk/i18n/messages/pt-BR.json +138 -1
- package/dist/sdk/identity/use-identity-actions.js +5 -4
- package/dist/sdk/identity/use-identity-actions.js.map +1 -1
- package/dist/sdk/navigation/current-page.js +30 -0
- package/dist/sdk/navigation/current-page.js.map +1 -0
- package/dist/sdk/navigation/not-found-log.d.ts +28 -0
- package/dist/sdk/navigation/not-found-log.js +133 -0
- package/dist/sdk/navigation/not-found-log.js.map +1 -0
- package/dist/sdk/navigation/path.js +25 -0
- package/dist/sdk/navigation/path.js.map +1 -0
- package/dist/sdk/navigation/redirect.d.ts +11 -0
- package/dist/sdk/navigation/redirect.js +22 -0
- package/dist/sdk/navigation/redirect.js.map +1 -0
- package/dist/sdk/navigation/report.js +70 -0
- package/dist/sdk/navigation/report.js.map +1 -0
- package/dist/sdk/navigation/resolve-storefront-href.d.ts +12 -0
- package/dist/sdk/navigation/resolve-storefront-href.js +214 -0
- package/dist/sdk/navigation/resolve-storefront-href.js.map +1 -0
- package/dist/sdk/navigation/route-identity-provider.d.ts +11 -0
- package/dist/sdk/navigation/route-identity-provider.js +20 -0
- package/dist/sdk/navigation/route-identity-provider.js.map +1 -0
- package/dist/sdk/navigation/route-map-provider.d.ts +19 -0
- package/dist/sdk/navigation/route-map-provider.js +29 -0
- package/dist/sdk/navigation/route-map-provider.js.map +1 -0
- package/dist/sdk/navigation/storefront-link.d.ts +16 -0
- package/dist/sdk/navigation/storefront-link.js +66 -0
- package/dist/sdk/navigation/storefront-link.js.map +1 -0
- package/dist/sdk/navigation/types.d.ts +45 -0
- package/dist/sdk/navigation/use-storefront-navigation.d.ts +26 -0
- package/dist/sdk/navigation/use-storefront-navigation.js +73 -0
- package/dist/sdk/navigation/use-storefront-navigation.js.map +1 -0
- package/dist/sdk/navigation/use-storefront-route.d.ts +26 -0
- package/dist/sdk/navigation/use-storefront-route.js +87 -0
- package/dist/sdk/navigation/use-storefront-route.js.map +1 -0
- package/dist/sdk/navigation/use-storefront-search-params.d.ts +11 -0
- package/dist/sdk/navigation/use-storefront-search-params.js +16 -0
- package/dist/sdk/navigation/use-storefront-search-params.js.map +1 -0
- package/dist/sdk/orders/completion-badge.d.ts +8 -0
- package/dist/sdk/orders/completion-badge.js +47 -0
- package/dist/sdk/orders/completion-badge.js.map +1 -0
- package/dist/sdk/orders/order-operations.d.ts +19 -0
- package/dist/sdk/orders/order-operations.js +21 -0
- package/dist/sdk/orders/order-operations.js.map +1 -0
- package/dist/sdk/orders/use-order-actions.d.ts +23 -0
- package/dist/sdk/orders/use-order-actions.js +62 -0
- package/dist/sdk/orders/use-order-actions.js.map +1 -0
- package/dist/sdk/payment/gateway-origin.js +26 -13
- package/dist/sdk/payment/gateway-origin.js.map +1 -1
- package/dist/sdk/payment/gateway.d.ts +14 -2
- package/dist/sdk/payment/gateway.js +32 -14
- package/dist/sdk/payment/gateway.js.map +1 -1
- package/dist/sdk/payment/operations.js +11 -0
- package/dist/sdk/payment/operations.js.map +1 -1
- package/dist/sdk/payment/submission-registry.d.ts +2 -1
- package/dist/sdk/payment/submission-registry.js +12 -8
- package/dist/sdk/payment/submission-registry.js.map +1 -1
- package/dist/sdk/payment/use-payment-actions.d.ts +5 -3
- package/dist/sdk/payment/use-payment-actions.js +6 -3
- package/dist/sdk/payment/use-payment-actions.js.map +1 -1
- package/dist/sdk/payment/use-place-order.d.ts +6 -3
- package/dist/sdk/payment/use-place-order.js +334 -144
- package/dist/sdk/payment/use-place-order.js.map +1 -1
- package/dist/sdk/region/use-region-actions.js +2 -1
- package/dist/sdk/region/use-region-actions.js.map +1 -1
- package/dist/sdk/seo/page-alternates.d.ts +55 -0
- package/dist/sdk/seo/page-alternates.js +132 -0
- package/dist/sdk/seo/page-alternates.js.map +1 -0
- package/dist/sdk/session/read-server-session.d.ts +21 -0
- package/dist/sdk/session/read-server-session.js +61 -0
- package/dist/sdk/session/read-server-session.js.map +1 -0
- package/dist/sdk/session/use-session-actions.js +5 -4
- package/dist/sdk/session/use-session-actions.js.map +1 -1
- package/dist/sdk/session/use-session-revalidation.js +2 -1
- package/dist/sdk/session/use-session-revalidation.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-actions.js +3 -2
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
- package/dist/utils/own-value.js +19 -0
- package/dist/utils/own-value.js.map +1 -0
- package/dist/utils/safe-href.d.ts +11 -0
- package/dist/utils/safe-href.js +31 -22
- package/dist/utils/safe-href.js.map +1 -1
- package/package.json +17 -2
- package/skills/storefront-asset/SKILL.md +111 -0
- package/skills/storefront-asset/references/api-side.md +153 -0
- package/skills/storefront-asset/references/findings.md +40 -0
- package/skills/storefront-asset/references/ui-side.md +94 -0
- package/src/styles/tailwind.css +27 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-summary.js","names":[],"sources":["../../../src/particles/address-summary/address-summary.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { createContext, type ReactNode, useContext } from 'react';\n\n/**\n * AddressSummary particle (no business coupling — ADR-0001): a presentational display for a\n * postal address, driven entirely by AddressSummaryRoot's context rather than props. Any matter\n * component that owns address data (e.g. ShippingAddressSelectedSummary, ShippingAddressSavedOption)\n * provides it via AddressSummaryRoot; AddressSummary reads and renders it. A future alternative\n * presentation (e.g. a \"LeanAddressSummary\") would read the same context and could be composed in\n * its place — swapping the presentation is a composition change, not a new data-binding.\n */\n\nexport type AddressSummaryFields = Readonly<{\n recipientName?: string | null;\n name?: string | null;\n street?: string | null;\n number?: string | null;\n complement?: string | null;\n neighborhood?: string | null;\n city?: string | null;\n state?: string | null;\n postalCode?: string | null;\n country?: string | null;\n reference?: string | null;\n}>;\n\nexport type AddressSummaryFieldKey = keyof AddressSummaryFields;\n\nconst AddressSummaryContext = createContext<AddressSummaryFields | null>(null);\n\nexport function useAddressSummary(): AddressSummaryFields {\n const ctx = useContext(AddressSummaryContext);\n if (!ctx) throw new Error('AddressSummary must be used inside AddressSummaryRoot.');\n return ctx;\n}\n\nexport type AddressSummaryRootProps = {\n /** The address fields provided to descendant presentational components via context. */\n address: AddressSummaryFields;\n children?: ReactNode;\n};\n\nexport type AddressSummaryProps = {\n className?: string;\n /** The lines to render, in order. Defaults to recipient, street, locality when omitted. */\n children?: ReactNode;\n};\n\nexport type AddressSummaryLineProps = {\n className?: string;\n};\n\nexport type AddressSummaryNameProps = Readonly<AddressSummaryLineProps>;\n\nexport type AddressSummaryCountryProps = Readonly<AddressSummaryLineProps>;\n\nexport type AddressSummaryFieldProps = Readonly<{\n /** Which address field to render inline. */\n field: AddressSummaryFieldKey;\n className?: string;\n}>;\n\nexport const AddressSummaryRootDefinition = defineComponent<AddressSummaryRootProps>({\n name: 'AddressSummaryRoot',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryRoot,\n providesContext: 'address-summary',\n editor: { label: 'Address Summary Root', category: 'content' },\n schema: {},\n guideline:\n 'Provides a postal address to descendant presentational components via context (no business coupling). Compose a matter component that owns address data as the source of the address prop, and AddressSummary (or a future alternative presentation reading the same context) as the child that renders it.',\n});\n\nexport const AddressSummaryDefinition = defineComponent<AddressSummaryProps>({\n name: 'AddressSummary',\n importPath: '@vtex/faststore/components',\n component: AddressSummary,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary', category: 'content' },\n schema: {},\n guideline:\n 'The address block: recipient, street line, locality line, in that order by default. Compose AddressSummaryRecipient / Street / Locality as children to choose the order or drop a line; the wrapper, and any styling on it, is the same either way. AddressSummaryName, AddressSummaryCountry and AddressSummaryField are also available for a custom composition — none of them join the default. Must be a descendant of AddressSummaryRoot.',\n});\n\nexport const AddressSummaryRecipientDefinition = defineComponent<AddressSummaryLineProps>({\n name: 'AddressSummaryRecipient',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryRecipient,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary Recipient', category: 'content' },\n schema: {},\n guideline:\n 'Who the delivery is addressed to, or nothing when the address carries no recipient. Place it in whatever order the summary should read. Must be a descendant of AddressSummaryRoot.',\n});\n\nexport const AddressSummaryStreetDefinition = defineComponent<AddressSummaryLineProps>({\n name: 'AddressSummaryStreet',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryStreet,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary Street', category: 'content' },\n schema: {},\n guideline:\n 'Street, number and complement on one line, or nothing when all three are absent. Must be a descendant of AddressSummaryRoot.',\n});\n\nexport const AddressSummaryLocalityDefinition = defineComponent<AddressSummaryLineProps>({\n name: 'AddressSummaryLocality',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryLocality,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary Locality', category: 'content' },\n schema: {},\n guideline:\n 'Neighborhood, city, state and postal code on one line, or nothing when all are absent. Must be a descendant of AddressSummaryRoot.',\n});\n\nexport const AddressSummaryNameDefinition = defineComponent<AddressSummaryNameProps>({\n name: 'AddressSummaryName',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryName,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary Name', category: 'content' },\n schema: {},\n guideline:\n \"The shopper's own label for the address, or nothing when there is none. An unnamed address is identified by its contents. Must be a descendant of AddressSummaryRoot.\",\n});\n\nexport const AddressSummaryCountryDefinition = defineComponent<AddressSummaryCountryProps>({\n name: 'AddressSummaryCountry',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryCountry,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary Country', category: 'content' },\n schema: {},\n guideline:\n \"The address's country, shown exactly as provided, or nothing when there is none. Provide a display name, not a raw code: the address stores an ISO alpha-3 code, which Intl.DisplayNames rejects. Must be a descendant of AddressSummaryRoot.\",\n});\n\nexport const AddressSummaryFieldDefinition = defineComponent<AddressSummaryFieldProps>({\n name: 'AddressSummaryField',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryField,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary Field', category: 'content' },\n schema: {\n field: {\n type: [\n 'recipientName',\n 'name',\n 'street',\n 'number',\n 'complement',\n 'neighborhood',\n 'city',\n 'state',\n 'postalCode',\n 'country',\n 'reference',\n ] as const,\n label: 'Field',\n },\n },\n guideline:\n \"One address field, rendered inline, or nothing when it is empty. Compose several to build a line in a country's own order (e.g. number before street), with the separators the composition supplies; a separator beside a field that turns out empty is the composition's to drop. Must be a descendant of AddressSummaryRoot.\",\n});\n\nexport function AddressSummaryRoot({ address, children }: AddressSummaryRootProps) {\n return <AddressSummaryContext.Provider value={address}>{children}</AddressSummaryContext.Provider>;\n}\n\nexport function AddressSummary({ className, children }: AddressSummaryProps) {\n return (\n <div className={className} data-fs-address-summary=\"\">\n {children ?? (\n <>\n <AddressSummaryRecipient />\n <AddressSummaryStreet />\n <AddressSummaryLocality />\n </>\n )}\n </div>\n );\n}\n\n/** Who the delivery is addressed to. Renders nothing when the address carries no recipient. */\nexport function AddressSummaryRecipient({ className }: AddressSummaryLineProps) {\n const { recipientName } = useAddressSummary();\n if (!recipientName) return null;\n return (\n <p className={className} data-fs-address-summary-recipient=\"\">\n {recipientName}\n </p>\n );\n}\n\n/** Street, number and complement on one line. Renders nothing when all three are absent. */\nexport function AddressSummaryStreet({ className }: AddressSummaryLineProps) {\n const { street, number, complement } = useAddressSummary();\n const line = [[street, number].filter(Boolean).join(', '), complement].filter(Boolean).join(' - ');\n if (!line) return null;\n return (\n <p className={className} data-fs-address-summary-address=\"\">\n {line}\n </p>\n );\n}\n\n/** Neighborhood, city, state and postal code on one line. Renders nothing when all are absent. */\nexport function AddressSummaryLocality({ className }: AddressSummaryLineProps) {\n const { neighborhood, city, state, postalCode } = useAddressSummary();\n const line = [neighborhood, [city, state].filter(Boolean).join(' - '), postalCode].filter(Boolean).join(', ');\n if (!line) return null;\n return (\n <p className={className} data-fs-address-summary-locality=\"\">\n {line}\n </p>\n );\n}\n\n/** The shopper's own label for the address. Renders nothing when the address carries no name. */\nexport function AddressSummaryName({ className }: AddressSummaryNameProps) {\n const { name } = useAddressSummary();\n if (!name) return null;\n return (\n <p className={className} data-fs-address-summary-name=\"\">\n {name}\n </p>\n );\n}\n\n/** The address's country, shown as provided. Renders nothing when the address carries no country. */\nexport function AddressSummaryCountry({ className }: AddressSummaryCountryProps) {\n const { country } = useAddressSummary();\n if (!country) return null;\n return (\n <p className={className} data-fs-address-summary-country=\"\">\n {country}\n </p>\n );\n}\n\n/** One address field, rendered inline. Renders nothing when that field is absent. */\nexport function AddressSummaryField({ field, className }: AddressSummaryFieldProps) {\n const address = useAddressSummary();\n const value = address[field];\n if (!value) return null;\n return (\n <span className={className} data-fs-address-summary-field={field}>\n {value}\n </span>\n );\n}\n"],"mappings":";;;;;;AA8BA,MAAM,wBAAwB,cAA2C,IAAI;AAE7E,SAAgB,oBAA0C;CACxD,MAAM,MAAM,WAAW,qBAAqB;CAC5C,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,wDAAwD;CAClF,OAAO;AACT;AA4BA,MAAa,+BAA+B,gBAAyC;CACnF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAwB,UAAU;CAAU;CAC7D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,2BAA2B,gBAAqC;CAC3E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAmB,UAAU;CAAU;CACxD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,oCAAoC,gBAAyC;CACxF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAA6B,UAAU;CAAU;CAClE,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,iCAAiC,gBAAyC;CACrF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAA0B,UAAU;CAAU;CAC/D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,mCAAmC,gBAAyC;CACvF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAA4B,UAAU;CAAU;CACjE,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QAAQ,eAAe,kBAAkB;CACzD,MAAM,OAAO,CAAC,CAAC,QAAQ,MAAM,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,IAAI,GAAG,UAAU,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,KAAK;CACjG,IAAI,CAAC,MAAM,OAAO;CAClB,OACE,oBAAC,KAAD;EAAc;EAAW,mCAAgC;EACtD,UAAA;CACA,CAAA;AAEP;;AAGA,SAAgB,uBAAuB,EAAE,aAAsC;CAC7E,MAAM,EAAE,cAAc,MAAM,OAAO,eAAe,kBAAkB;CACpE,MAAM,OAAO;EAAC;EAAc,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,KAAK;EAAG;CAAU,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,IAAI;CAC5G,IAAI,CAAC,MAAM,OAAO;CAClB,OACE,oBAAC,KAAD;EAAc;EAAW,oCAAiC;EACvD,UAAA;CACA,CAAA;AAEP;;AAGA,SAAgB,mBAAmB,EAAE,aAAsC;CACzE,MAAM,EAAE,SAAS,kBAAkB;CACnC,IAAI,CAAC,MAAM,OAAO;CAClB,OACE,oBAAC,KAAD;EAAc;EAAW,gCAA6B;EACnD,UAAA;CACA,CAAA;AAEP;;AAGA,SAAgB,sBAAsB,EAAE,aAAyC;CAC/E,MAAM,EAAE,YAAY,kBAAkB;CACtC,IAAI,CAAC,SAAS,OAAO;CACrB,OACE,oBAAC,KAAD;EAAc;EAAW,mCAAgC;EACtD,UAAA;CACA,CAAA;AAEP;;AAGA,SAAgB,oBAAoB,EAAE,OAAO,aAAuC;CAElF,MAAM,QADU,kBACI,CAAC,CAAC;CACtB,IAAI,CAAC,OAAO,OAAO;CACnB,OACE,oBAAC,QAAD;EAAiB;EAAW,iCAA+B;EACxD,UAAA;CACG,CAAA;AAEV"}
|
|
1
|
+
{"version":3,"file":"address-summary.js","names":[],"sources":["../../../src/particles/address-summary/address-summary.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { createContext, type ReactNode, useContext } from 'react';\n\n/**\n * AddressSummary particle (no business coupling — ADR-0001): a presentational display for a\n * postal address, driven entirely by AddressSummaryRoot's context rather than props. Any matter\n * component that owns address data (e.g. ShippingAddressSelectedSummary, ShippingAddressSavedOption)\n * provides it via AddressSummaryRoot; AddressSummary reads and renders it. A future alternative\n * presentation (e.g. a \"LeanAddressSummary\") would read the same context and could be composed in\n * its place — swapping the presentation is a composition change, not a new data-binding.\n */\n\nexport type AddressSummaryFields = Readonly<{\n recipientName?: string | null;\n name?: string | null;\n street?: string | null;\n number?: string | null;\n complement?: string | null;\n neighborhood?: string | null;\n city?: string | null;\n state?: string | null;\n postalCode?: string | null;\n country?: string | null;\n reference?: string | null;\n}>;\n\nexport type AddressSummaryFieldKey = keyof AddressSummaryFields;\n\nconst AddressSummaryContext = createContext<AddressSummaryFields | null>(null);\n\nexport function useAddressSummary(): AddressSummaryFields {\n const ctx = useContext(AddressSummaryContext);\n if (!ctx) throw new Error('AddressSummary must be used inside AddressSummaryRoot.');\n return ctx;\n}\n\nexport type AddressSummaryRootProps = {\n /** The address fields provided to descendant presentational components via context. */\n address: AddressSummaryFields;\n children?: ReactNode;\n};\n\nexport type AddressSummaryProps = {\n className?: string;\n /** The lines to render, in order. Defaults to recipient, street, locality when omitted. */\n children?: ReactNode;\n};\n\nexport type AddressSummaryLineProps = {\n className?: string;\n};\n\nexport type AddressSummaryNameProps = Readonly<AddressSummaryLineProps>;\n\nexport type AddressSummaryCountryProps = Readonly<AddressSummaryLineProps>;\n\nexport type AddressSummaryFieldProps = Readonly<{\n /** Which address field to render inline. */\n field: AddressSummaryFieldKey;\n className?: string;\n}>;\n\nexport const AddressSummaryRootDefinition = defineComponent<AddressSummaryRootProps>({\n name: 'AddressSummaryRoot',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryRoot,\n providesContext: 'address-summary',\n editor: { label: 'Address Summary Root', category: 'content' },\n schema: {},\n guideline:\n 'Provides a postal address to descendant presentational components via context (no business coupling). Compose a matter component that owns address data as the source of the address prop, and AddressSummary (or a future alternative presentation reading the same context) as the child that renders it.',\n});\n\nexport const AddressSummaryDefinition = defineComponent<AddressSummaryProps>({\n name: 'AddressSummary',\n importPath: '@vtex/faststore/components',\n component: AddressSummary,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary', category: 'content' },\n schema: {},\n guideline:\n 'The address block: recipient, street line, locality line, in that order by default. Compose AddressSummaryRecipient / Street / Locality as children to choose the order or drop a line; the wrapper, and any styling on it, is the same either way. AddressSummaryName, AddressSummaryCountry and AddressSummaryField are also available for a custom composition — none of them join the default. Must be a descendant of AddressSummaryRoot.',\n});\n\nexport const AddressSummaryRecipientDefinition = defineComponent<AddressSummaryLineProps>({\n name: 'AddressSummaryRecipient',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryRecipient,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary Recipient', category: 'content' },\n schema: {},\n guideline:\n 'Who the delivery is addressed to, or nothing when the address carries no recipient. Place it in whatever order the summary should read. Must be a descendant of AddressSummaryRoot.',\n});\n\nexport const AddressSummaryStreetDefinition = defineComponent<AddressSummaryLineProps>({\n name: 'AddressSummaryStreet',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryStreet,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary Street', category: 'content' },\n schema: {},\n guideline:\n 'Street, number and complement on one line, or nothing when all three are absent. Must be a descendant of AddressSummaryRoot.',\n});\n\nexport const AddressSummaryLocalityDefinition = defineComponent<AddressSummaryLineProps>({\n name: 'AddressSummaryLocality',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryLocality,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary Locality', category: 'content' },\n schema: {},\n guideline:\n 'Neighborhood, city, state and postal code on one line, or nothing when all are absent. Must be a descendant of AddressSummaryRoot.',\n});\n\nexport const AddressSummaryNameDefinition = defineComponent<AddressSummaryNameProps>({\n name: 'AddressSummaryName',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryName,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary Name', category: 'content' },\n schema: {},\n guideline:\n \"The shopper's own label for the address, or nothing when there is none. An unnamed address is identified by its contents. Must be a descendant of AddressSummaryRoot.\",\n});\n\nexport const AddressSummaryCountryDefinition = defineComponent<AddressSummaryCountryProps>({\n name: 'AddressSummaryCountry',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryCountry,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary Country', category: 'content' },\n schema: {},\n guideline:\n \"The address's country, shown exactly as provided, or nothing when there is none. Provide a display name, not a raw code: the address stores an ISO alpha-3 code, which Intl.DisplayNames rejects. Must be a descendant of AddressSummaryRoot.\",\n});\n\nexport const AddressSummaryFieldDefinition = defineComponent<AddressSummaryFieldProps>({\n name: 'AddressSummaryField',\n importPath: '@vtex/faststore/components',\n component: AddressSummaryField,\n requiresContext: 'address-summary',\n editor: { label: 'Address Summary Field', category: 'content' },\n schema: {\n field: {\n type: [\n 'recipientName',\n 'name',\n 'street',\n 'number',\n 'complement',\n 'neighborhood',\n 'city',\n 'state',\n 'postalCode',\n 'country',\n 'reference',\n ] as const,\n label: 'Field',\n },\n },\n guideline:\n \"One address field, rendered inline, or nothing when it is empty. Compose several to build a line in a country's own order (e.g. number before street), with the separators the composition supplies; a separator beside a field that turns out empty is the composition's to drop. Must be a descendant of AddressSummaryRoot.\",\n});\n\nexport function AddressSummaryRoot({ address, children }: AddressSummaryRootProps) {\n return <AddressSummaryContext.Provider value={address}>{children}</AddressSummaryContext.Provider>;\n}\n\nexport function AddressSummary({ className, children }: AddressSummaryProps) {\n return (\n <div className={className} data-fs-address-summary=\"\">\n {children ?? (\n <>\n <AddressSummaryRecipient />\n <AddressSummaryStreet />\n <AddressSummaryLocality />\n </>\n )}\n </div>\n );\n}\n\n/** Who the delivery is addressed to. Renders nothing when the address carries no recipient. */\nexport function AddressSummaryRecipient({ className }: AddressSummaryLineProps) {\n const { recipientName } = useAddressSummary();\n if (!recipientName) return null;\n return (\n <p className={className} data-fs-address-summary-recipient=\"\">\n {recipientName}\n </p>\n );\n}\n\n/** Street, number and complement on one line. Renders nothing when all three are absent. */\nexport function AddressSummaryStreet({ className }: AddressSummaryLineProps) {\n const { street, number, complement } = useAddressSummary();\n const line = [[street, number].filter(Boolean).join(', '), complement].filter(Boolean).join(' - ');\n if (!line) return null;\n return (\n <p className={className} data-fs-address-summary-address=\"\">\n {line}\n </p>\n );\n}\n\n/** Neighborhood, city, state and postal code on one line. Renders nothing when all are absent. */\nexport function AddressSummaryLocality({ className }: AddressSummaryLineProps) {\n const { neighborhood, city, state, postalCode } = useAddressSummary();\n const line = [neighborhood, [city, state].filter(Boolean).join(' - '), postalCode].filter(Boolean).join(', ');\n if (!line) return null;\n return (\n <p className={className} data-fs-address-summary-locality=\"\">\n {line}\n </p>\n );\n}\n\n/** The shopper's own label for the address. Renders nothing when the address carries no name. */\nexport function AddressSummaryName({ className }: AddressSummaryNameProps) {\n const { name } = useAddressSummary();\n if (!name) return null;\n return (\n <p className={className} data-fs-address-summary-name=\"\">\n {name}\n </p>\n );\n}\n\n/** The address's country, shown as provided. Renders nothing when the address carries no country. */\nexport function AddressSummaryCountry({ className }: AddressSummaryCountryProps) {\n const { country } = useAddressSummary();\n if (!country) return null;\n return (\n <p className={className} data-fs-address-summary-country=\"\">\n {country}\n </p>\n );\n}\n\n/** One address field, rendered inline. Renders nothing when that field is absent. */\nexport function AddressSummaryField({ field, className }: AddressSummaryFieldProps) {\n const address = useAddressSummary();\n const value = address[field];\n if (!value) return null;\n return (\n <span className={className} data-fs-address-summary-field={field}>\n {value}\n </span>\n );\n}\n"],"mappings":";;;;;;AA8BA,MAAM,wBAAwB,cAA2C,IAAI;AAE7E,SAAgB,oBAA0C;CACxD,MAAM,MAAM,WAAW,qBAAqB;CAC5C,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,wDAAwD;CAClF,OAAO;AACT;AA4B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;EAAG;CAAU,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,IAAI;CAC5G,IAAI,CAAC,MAAM,OAAO;CAClB,OACE,oBAAC,KAAD;EAAc;EAAW,oCAAiC;EACvD,UAAA;CACA,CAAA;AAEP;;AAGA,SAAgB,mBAAmB,EAAE,aAAsC;CACzE,MAAM,EAAE,SAAS,kBAAkB;CACnC,IAAI,CAAC,MAAM,OAAO;CAClB,OACE,oBAAC,KAAD;EAAc;EAAW,gCAA6B;EACnD,UAAA;CACA,CAAA;AAEP;;AAGA,SAAgB,sBAAsB,EAAE,aAAyC;CAC/E,MAAM,EAAE,YAAY,kBAAkB;CACtC,IAAI,CAAC,SAAS,OAAO;CACrB,OACE,oBAAC,KAAD;EAAc;EAAW,mCAAgC;EACtD,UAAA;CACA,CAAA;AAEP;;AAGA,SAAgB,oBAAoB,EAAE,OAAO,aAAuC;CAElF,MAAM,QADU,kBACI,CAAC,CAAC;CACtB,IAAI,CAAC,OAAO,OAAO;CACnB,OACE,oBAAC,QAAD;EAAiB;EAAW,iCAA+B;EACxD,UAAA;CACG,CAAA;AAEV"}
|
|
@@ -15,6 +15,8 @@ export type AlertDialogRootProps = Readonly<{
|
|
|
15
15
|
export type AlertDialogTriggerProps = ComponentPropsWithRef<'button'>;
|
|
16
16
|
export type AlertDialogPortalProps = Readonly<{
|
|
17
17
|
children?: ReactNode;
|
|
18
|
+
/** Parent element for the overlay. Omit it and the overlay renders on `document.body`. */
|
|
19
|
+
container?: ComponentProps<typeof AlertDialog.Portal>['container'];
|
|
18
20
|
}>;
|
|
19
21
|
export type AlertDialogBackdropProps = ComponentPropsWithRef<'div'>;
|
|
20
22
|
export type AlertDialogViewportProps = ComponentPropsWithRef<'div'>;
|
|
@@ -36,6 +38,8 @@ export declare const AlertDialogRootDefinition: ComponentDefinition<Readonly<{
|
|
|
36
38
|
export declare const AlertDialogTriggerDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
|
|
37
39
|
export declare const AlertDialogPortalDefinition: ComponentDefinition<Readonly<{
|
|
38
40
|
children?: ReactNode;
|
|
41
|
+
/** Parent element for the overlay. Omit it and the overlay renders on `document.body`. */
|
|
42
|
+
container?: ComponentProps<typeof AlertDialog.Portal>["container"];
|
|
39
43
|
}>>;
|
|
40
44
|
export declare const AlertDialogBackdropDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
41
45
|
export declare const AlertDialogViewportDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
@@ -45,7 +49,7 @@ export declare const AlertDialogDescriptionDefinition: ComponentDefinition<impor
|
|
|
45
49
|
export declare const AlertDialogCloseDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
|
|
46
50
|
export declare function AlertDialogRoot({ open, defaultOpen, onOpenChange, children }: AlertDialogRootProps): import("react/jsx-runtime").JSX.Element;
|
|
47
51
|
export declare function AlertDialogTrigger({ className, children, ...props }: AlertDialogTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
-
export declare function AlertDialogPortal({ children }: AlertDialogPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export declare function AlertDialogPortal({ children, container }: AlertDialogPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
49
53
|
export declare function AlertDialogBackdrop({ className, children, ...props }: AlertDialogBackdropProps): import("react/jsx-runtime").JSX.Element;
|
|
50
54
|
export declare function AlertDialogViewport({ className, children, ...props }: AlertDialogViewportProps): import("react/jsx-runtime").JSX.Element;
|
|
51
55
|
export declare function AlertDialogPopup({ className, children, ...props }: AlertDialogPopupProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -119,8 +119,11 @@ function AlertDialogTrigger({ className, children, ...props }) {
|
|
|
119
119
|
children
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
function AlertDialogPortal({ children }) {
|
|
123
|
-
return /* @__PURE__ */ jsx(AlertDialog.Portal, {
|
|
122
|
+
function AlertDialogPortal({ children, container }) {
|
|
123
|
+
return /* @__PURE__ */ jsx(AlertDialog.Portal, {
|
|
124
|
+
container,
|
|
125
|
+
children
|
|
126
|
+
});
|
|
124
127
|
}
|
|
125
128
|
function AlertDialogBackdrop({ className, children, ...props }) {
|
|
126
129
|
return /* @__PURE__ */ jsx(AlertDialog.Backdrop, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.js","names":["BaseAlertDialog","AlertDialog"],"sources":["../../../src/particles/alert-dialog/alert-dialog.tsx"],"sourcesContent":["'use client';\nimport { AlertDialog as BaseAlertDialog } from '@base-ui/react/alert-dialog';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentProps, ComponentPropsWithRef, ReactNode } from 'react';\n\ntype BasePopupProps = ComponentProps<typeof BaseAlertDialog.Popup>;\n\nexport type AlertDialogRootProps = Readonly<{\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean, eventDetails: { isCanceled: boolean }) => void;\n children?: ReactNode;\n}>;\n\nexport type AlertDialogTriggerProps = ComponentPropsWithRef<'button'>;\n\nexport type AlertDialogPortalProps = Readonly<{\n children?: ReactNode;\n}>;\n\nexport type AlertDialogBackdropProps = ComponentPropsWithRef<'div'>;\n\nexport type AlertDialogViewportProps = ComponentPropsWithRef<'div'>;\n\nexport type AlertDialogPopupProps = ComponentPropsWithRef<'div'> & {\n initialFocus?: BasePopupProps['initialFocus'];\n finalFocus?: BasePopupProps['finalFocus'];\n};\n\nexport type AlertDialogTitleProps = ComponentPropsWithRef<'h2'>;\n\nexport type AlertDialogDescriptionProps = ComponentPropsWithRef<'p'>;\n\nexport type AlertDialogCloseProps = ComponentPropsWithRef<'button'>;\n\nexport const AlertDialogRootDefinition = defineComponent<AlertDialogRootProps>({\n name: 'AlertDialogRoot',\n importPath: '@vtex/faststore/components',\n component: AlertDialogRoot,\n editor: { label: 'Alert Dialog Root', category: 'layout' },\n schema: {},\n guideline:\n 'Root of a confirmation prompt for an irreversible action. Compose as: AlertDialogRoot > (AlertDialogTrigger + AlertDialogPortal > (AlertDialogBackdrop + AlertDialogViewport > AlertDialogPopup > (AlertDialogTitle + AlertDialogDescription + AlertDialogClose + your confirm Button))). Always modal and never closes on an outside click; only Escape or an AlertDialogClose dismisses it. Use Dialog instead when a stray click may close the overlay.',\n});\n\nexport const AlertDialogTriggerDefinition = defineComponent<AlertDialogTriggerProps>({\n name: 'AlertDialogTrigger',\n importPath: '@vtex/faststore/components',\n component: AlertDialogTrigger,\n editor: { label: 'Alert Dialog Trigger', category: 'action' },\n schema: {},\n guideline:\n 'Opens the alert dialog when clicked. Direct child of AlertDialogRoot. Accepts any children (text, Icon). Base UI connects it to AlertDialogRoot via context — no explicit wiring needed.',\n});\n\nexport const AlertDialogPortalDefinition = defineComponent<AlertDialogPortalProps>({\n name: 'AlertDialogPortal',\n importPath: '@vtex/faststore/components',\n component: AlertDialogPortal,\n editor: { label: 'Alert Dialog Portal', category: 'layout' },\n schema: {},\n guideline:\n 'Renders its children outside the DOM tree (into document.body). Place AlertDialogBackdrop and AlertDialogViewport as direct children, in that order.',\n});\n\nexport const AlertDialogBackdropDefinition = defineComponent<AlertDialogBackdropProps>({\n name: 'AlertDialogBackdrop',\n importPath: '@vtex/faststore/components',\n component: AlertDialogBackdrop,\n editor: { label: 'Alert Dialog Backdrop', category: 'layout' },\n schema: {},\n guideline:\n 'Semi-transparent overlay behind the popup. Direct child of AlertDialogPortal, before AlertDialogViewport. Clicking it does not close the alert dialog.',\n});\n\nexport const AlertDialogViewportDefinition = defineComponent<AlertDialogViewportProps>({\n name: 'AlertDialogViewport',\n importPath: '@vtex/faststore/components',\n component: AlertDialogViewport,\n editor: { label: 'Alert Dialog Viewport', category: 'layout' },\n schema: {},\n guideline:\n 'Positioning container for AlertDialogPopup. Direct child of AlertDialogPortal, after AlertDialogBackdrop. Apply fixed positioning and centering here (e.g. fixed inset-0 flex items-center justify-center). Place AlertDialogPopup inside.',\n});\n\nexport const AlertDialogPopupDefinition = defineComponent<AlertDialogPopupProps>({\n name: 'AlertDialogPopup',\n importPath: '@vtex/faststore/components',\n component: AlertDialogPopup,\n editor: { label: 'Alert Dialog Popup', category: 'layout' },\n schema: {},\n guideline:\n 'The visible prompt, inside AlertDialogViewport, with role alertdialog. Place AlertDialogTitle (required), AlertDialogDescription, an AlertDialogClose for cancel, and a confirm Button inside. Focus starts on the first focusable element, except when opened by touch, where Base UI focuses the popup itself: put the cancel control first, and pass initialFocus (a ref) when Cancel must receive focus for every kind of interaction.',\n});\n\nexport const AlertDialogTitleDefinition = defineComponent<AlertDialogTitleProps>({\n name: 'AlertDialogTitle',\n importPath: '@vtex/faststore/components',\n component: AlertDialogTitle,\n editor: { label: 'Alert Dialog Title', category: 'layout' },\n schema: {},\n guideline:\n 'Required heading inside AlertDialogPopup — sets the accessible name of the alert dialog for screen readers. State the question, e.g. \"Delete this address?\".',\n});\n\nexport const AlertDialogDescriptionDefinition = defineComponent<AlertDialogDescriptionProps>({\n name: 'AlertDialogDescription',\n importPath: '@vtex/faststore/components',\n component: AlertDialogDescription,\n editor: { label: 'Alert Dialog Description', category: 'layout' },\n schema: {},\n guideline:\n 'Description inside AlertDialogPopup, after AlertDialogTitle. Screen readers announce it with the prompt, so use it to state the consequence of confirming.',\n});\n\nexport const AlertDialogCloseDefinition = defineComponent<AlertDialogCloseProps>({\n name: 'AlertDialogClose',\n importPath: '@vtex/faststore/components',\n component: AlertDialogClose,\n editor: { label: 'Alert Dialog Close', category: 'action' },\n schema: {},\n guideline:\n 'Closes the alert dialog when clicked. Use it for the cancel control inside AlertDialogPopup. The confirm control is a separate Button that runs the consumer action.',\n});\n\nexport function AlertDialogRoot({ open, defaultOpen, onOpenChange, children }: AlertDialogRootProps) {\n return (\n <BaseAlertDialog.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n {children}\n </BaseAlertDialog.Root>\n );\n}\n\nexport function AlertDialogTrigger({ className, children, ...props }: AlertDialogTriggerProps) {\n return (\n <BaseAlertDialog.Trigger {...props} className={className} data-fs-alert-dialog-trigger=\"\">\n {children}\n </BaseAlertDialog.Trigger>\n );\n}\n\nexport function AlertDialogPortal({ children }: AlertDialogPortalProps) {\n return <BaseAlertDialog.Portal>{children}</BaseAlertDialog.Portal>;\n}\n\nexport function AlertDialogBackdrop({ className, children, ...props }: AlertDialogBackdropProps) {\n return (\n <BaseAlertDialog.Backdrop {...props} className={className} data-fs-alert-dialog-backdrop=\"\">\n {children}\n </BaseAlertDialog.Backdrop>\n );\n}\n\nexport function AlertDialogViewport({ className, children, ...props }: AlertDialogViewportProps) {\n return (\n <div {...props} className={className} data-fs-alert-dialog-viewport=\"\">\n {children}\n </div>\n );\n}\n\nexport function AlertDialogPopup({ className, children, ...props }: AlertDialogPopupProps) {\n return (\n <BaseAlertDialog.Popup {...props} className={className} data-fs-alert-dialog-popup=\"\">\n {children}\n </BaseAlertDialog.Popup>\n );\n}\n\nexport function AlertDialogTitle({ className, children, ...props }: AlertDialogTitleProps) {\n return (\n <BaseAlertDialog.Title {...props} className={className} data-fs-alert-dialog-title=\"\">\n {children}\n </BaseAlertDialog.Title>\n );\n}\n\nexport function AlertDialogDescription({ className, children, ...props }: AlertDialogDescriptionProps) {\n return (\n <BaseAlertDialog.Description {...props} className={className} data-fs-alert-dialog-description=\"\">\n {children}\n </BaseAlertDialog.Description>\n );\n}\n\nexport function AlertDialogClose({ className, children, ...props }: AlertDialogCloseProps) {\n return (\n <BaseAlertDialog.Close {...props} className={className} data-fs-alert-dialog-close=\"\">\n {children}\n </BaseAlertDialog.Close>\n );\n}\n\nexport const AlertDialog = {\n Root: AlertDialogRoot,\n Trigger: AlertDialogTrigger,\n Portal: AlertDialogPortal,\n Backdrop: AlertDialogBackdrop,\n Viewport: AlertDialogViewport,\n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,GAAI;EAAkB;EAAW,oCAAiC;EAC5F;CAC0B,CAAA;AAEjC;AAEA,SAAgB,iBAAiB,EAAE,WAAW,UAAU,GAAG,SAAgC;CACzF,OACE,oBAACA,YAAgB,OAAjB;EAAuB,GAAI;EAAkB;EAAW,8BAA2B;EAChF;CACoB,CAAA;AAE3B;AAEA,MAAaC,gBAAc;CACzB,MAAM;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,OAAO;CACP,OAAO;CACP,aAAa;CACb,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"alert-dialog.js","names":["BaseAlertDialog","AlertDialog"],"sources":["../../../src/particles/alert-dialog/alert-dialog.tsx"],"sourcesContent":["'use client';\nimport { AlertDialog as BaseAlertDialog } from '@base-ui/react/alert-dialog';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentProps, ComponentPropsWithRef, ReactNode } from 'react';\n\ntype BasePopupProps = ComponentProps<typeof BaseAlertDialog.Popup>;\n\nexport type AlertDialogRootProps = Readonly<{\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean, eventDetails: { isCanceled: boolean }) => void;\n children?: ReactNode;\n}>;\n\nexport type AlertDialogTriggerProps = ComponentPropsWithRef<'button'>;\n\nexport type AlertDialogPortalProps = Readonly<{\n children?: ReactNode;\n /** Parent element for the overlay. Omit it and the overlay renders on `document.body`. */\n container?: ComponentProps<typeof BaseAlertDialog.Portal>['container'];\n}>;\n\nexport type AlertDialogBackdropProps = ComponentPropsWithRef<'div'>;\n\nexport type AlertDialogViewportProps = ComponentPropsWithRef<'div'>;\n\nexport type AlertDialogPopupProps = ComponentPropsWithRef<'div'> & {\n initialFocus?: BasePopupProps['initialFocus'];\n finalFocus?: BasePopupProps['finalFocus'];\n};\n\nexport type AlertDialogTitleProps = ComponentPropsWithRef<'h2'>;\n\nexport type AlertDialogDescriptionProps = ComponentPropsWithRef<'p'>;\n\nexport type AlertDialogCloseProps = ComponentPropsWithRef<'button'>;\n\nexport const AlertDialogRootDefinition = defineComponent<AlertDialogRootProps>({\n name: 'AlertDialogRoot',\n importPath: '@vtex/faststore/components',\n component: AlertDialogRoot,\n editor: { label: 'Alert Dialog Root', category: 'layout' },\n schema: {},\n guideline:\n 'Root of a confirmation prompt for an irreversible action. Compose as: AlertDialogRoot > (AlertDialogTrigger + AlertDialogPortal > (AlertDialogBackdrop + AlertDialogViewport > AlertDialogPopup > (AlertDialogTitle + AlertDialogDescription + AlertDialogClose + your confirm Button))). Always modal and never closes on an outside click; only Escape or an AlertDialogClose dismisses it. Use Dialog instead when a stray click may close the overlay.',\n});\n\nexport const AlertDialogTriggerDefinition = defineComponent<AlertDialogTriggerProps>({\n name: 'AlertDialogTrigger',\n importPath: '@vtex/faststore/components',\n component: AlertDialogTrigger,\n editor: { label: 'Alert Dialog Trigger', category: 'action' },\n schema: {},\n guideline:\n 'Opens the alert dialog when clicked. Direct child of AlertDialogRoot. Accepts any children (text, Icon). Base UI connects it to AlertDialogRoot via context — no explicit wiring needed.',\n});\n\nexport const AlertDialogPortalDefinition = defineComponent<AlertDialogPortalProps>({\n name: 'AlertDialogPortal',\n importPath: '@vtex/faststore/components',\n component: AlertDialogPortal,\n editor: { label: 'Alert Dialog Portal', category: 'layout' },\n schema: {},\n guideline:\n 'Renders its children outside the DOM tree (into document.body). Place AlertDialogBackdrop and AlertDialogViewport as direct children, in that order.',\n});\n\nexport const AlertDialogBackdropDefinition = defineComponent<AlertDialogBackdropProps>({\n name: 'AlertDialogBackdrop',\n importPath: '@vtex/faststore/components',\n component: AlertDialogBackdrop,\n editor: { label: 'Alert Dialog Backdrop', category: 'layout' },\n schema: {},\n guideline:\n 'Semi-transparent overlay behind the popup. Direct child of AlertDialogPortal, before AlertDialogViewport. Clicking it does not close the alert dialog.',\n});\n\nexport const AlertDialogViewportDefinition = defineComponent<AlertDialogViewportProps>({\n name: 'AlertDialogViewport',\n importPath: '@vtex/faststore/components',\n component: AlertDialogViewport,\n editor: { label: 'Alert Dialog Viewport', category: 'layout' },\n schema: {},\n guideline:\n 'Positioning container for AlertDialogPopup. Direct child of AlertDialogPortal, after AlertDialogBackdrop. Apply fixed positioning and centering here (e.g. fixed inset-0 flex items-center justify-center). Place AlertDialogPopup inside.',\n});\n\nexport const AlertDialogPopupDefinition = defineComponent<AlertDialogPopupProps>({\n name: 'AlertDialogPopup',\n importPath: '@vtex/faststore/components',\n component: AlertDialogPopup,\n editor: { label: 'Alert Dialog Popup', category: 'layout' },\n schema: {},\n guideline:\n 'The visible prompt, inside AlertDialogViewport, with role alertdialog. Place AlertDialogTitle (required), AlertDialogDescription, an AlertDialogClose for cancel, and a confirm Button inside. Focus starts on the first focusable element, except when opened by touch, where Base UI focuses the popup itself: put the cancel control first, and pass initialFocus (a ref) when Cancel must receive focus for every kind of interaction.',\n});\n\nexport const AlertDialogTitleDefinition = defineComponent<AlertDialogTitleProps>({\n name: 'AlertDialogTitle',\n importPath: '@vtex/faststore/components',\n component: AlertDialogTitle,\n editor: { label: 'Alert Dialog Title', category: 'layout' },\n schema: {},\n guideline:\n 'Required heading inside AlertDialogPopup — sets the accessible name of the alert dialog for screen readers. State the question, e.g. \"Delete this address?\".',\n});\n\nexport const AlertDialogDescriptionDefinition = defineComponent<AlertDialogDescriptionProps>({\n name: 'AlertDialogDescription',\n importPath: '@vtex/faststore/components',\n component: AlertDialogDescription,\n editor: { label: 'Alert Dialog Description', category: 'layout' },\n schema: {},\n guideline:\n 'Description inside AlertDialogPopup, after AlertDialogTitle. Screen readers announce it with the prompt, so use it to state the consequence of confirming.',\n});\n\nexport const AlertDialogCloseDefinition = defineComponent<AlertDialogCloseProps>({\n name: 'AlertDialogClose',\n importPath: '@vtex/faststore/components',\n component: AlertDialogClose,\n editor: { label: 'Alert Dialog Close', category: 'action' },\n schema: {},\n guideline:\n 'Closes the alert dialog when clicked. Use it for the cancel control inside AlertDialogPopup. The confirm control is a separate Button that runs the consumer action.',\n});\n\nexport function AlertDialogRoot({ open, defaultOpen, onOpenChange, children }: AlertDialogRootProps) {\n return (\n <BaseAlertDialog.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n {children}\n </BaseAlertDialog.Root>\n );\n}\n\nexport function AlertDialogTrigger({ className, children, ...props }: AlertDialogTriggerProps) {\n return (\n <BaseAlertDialog.Trigger {...props} className={className} data-fs-alert-dialog-trigger=\"\">\n {children}\n </BaseAlertDialog.Trigger>\n );\n}\n\nexport function AlertDialogPortal({ children, container }: AlertDialogPortalProps) {\n return <BaseAlertDialog.Portal container={container}>{children}</BaseAlertDialog.Portal>;\n}\n\nexport function AlertDialogBackdrop({ className, children, ...props }: AlertDialogBackdropProps) {\n return (\n <BaseAlertDialog.Backdrop {...props} className={className} data-fs-alert-dialog-backdrop=\"\">\n {children}\n </BaseAlertDialog.Backdrop>\n );\n}\n\nexport function AlertDialogViewport({ className, children, ...props }: AlertDialogViewportProps) {\n return (\n <div {...props} className={className} data-fs-alert-dialog-viewport=\"\">\n {children}\n </div>\n );\n}\n\nexport function AlertDialogPopup({ className, children, ...props }: AlertDialogPopupProps) {\n return (\n <BaseAlertDialog.Popup {...props} className={className} data-fs-alert-dialog-popup=\"\">\n {children}\n </BaseAlertDialog.Popup>\n );\n}\n\nexport function AlertDialogTitle({ className, children, ...props }: AlertDialogTitleProps) {\n return (\n <BaseAlertDialog.Title {...props} className={className} data-fs-alert-dialog-title=\"\">\n {children}\n </BaseAlertDialog.Title>\n );\n}\n\nexport function AlertDialogDescription({ className, children, ...props }: AlertDialogDescriptionProps) {\n return (\n <BaseAlertDialog.Description {...props} className={className} data-fs-alert-dialog-description=\"\">\n {children}\n </BaseAlertDialog.Description>\n );\n}\n\nexport function AlertDialogClose({ className, children, ...props }: AlertDialogCloseProps) {\n return (\n <BaseAlertDialog.Close {...props} className={className} data-fs-alert-dialog-close=\"\">\n {children}\n </BaseAlertDialog.Close>\n );\n}\n\nexport const AlertDialog = {\n Root: AlertDialogRoot,\n Trigger: AlertDialogTrigger,\n Portal: AlertDialogPortal,\n Backdrop: AlertDialogBackdrop,\n Viewport: AlertDialogViewport,\n Popup: AlertDialogPopup,\n Title: AlertDialogTitle,\n Description: AlertDialogDescription,\n Close: AlertDialogClose,\n};\n"],"mappings":";;;;;;AAqCA,MAAa,4BAA4B,gBAAsC;CAC7E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAqB,UAAU;CAAS;CACzD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,+BAA+B,gBAAyC;CACnF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAwB,UAAU;CAAS;CAC5D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,8BAA8B,gBAAwC;CACjF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAuB,UAAU;CAAS;CAC3D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,gCAAgC,gBAA0C;CACrF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAyB,UAAU;CAAS;CAC7D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,gCAAgC,gBAA0C;CACrF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAyB,UAAU;CAAS;CAC7D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,6BAA6B,gBAAuC;CAC/E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAsB,UAAU;CAAS;CAC1D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,6BAA6B,gBAAuC;CAC/E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAsB,UAAU;CAAS;CAC1D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,mCAAmC,gBAA6C;CAC3F,MAAM;CACN,YA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,WAAW,UAAU,GAAG,SAAsC;CACrG,OACE,oBAACA,YAAgB,aAAjB;EAA6B,GAAI;EAAkB;EAAW,oCAAiC;EAC5F;CAC0B,CAAA;AAEjC;AAEA,SAAgB,iBAAiB,EAAE,WAAW,UAAU,GAAG,SAAgC;CACzF,OACE,oBAACA,YAAgB,OAAjB;EAAuB,GAAI;EAAkB;EAAW,8BAA2B;EAChF;CACoB,CAAA;AAE3B;AAEA,MAAaC,gBAAc;CACzB,MAAM;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,OAAO;CACP,OAAO;CACP,aAAa;CACb,OAAO;AACT"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { ComponentPropsWithRef } from "react";
|
|
4
|
+
//#region src/particles/avatar/avatar.d.ts
|
|
5
|
+
/** Props for {@link Avatar}. Extends the native `<span>` attributes, minus `children`. */
|
|
6
|
+
export type AvatarProps = Omit<ComponentPropsWithRef<'span'>, 'children'> & {
|
|
7
|
+
/** Whose avatar this is. The initials derive from it. */
|
|
8
|
+
name?: string;
|
|
9
|
+
/** Image URL. Absent or empty, the initials show. */
|
|
10
|
+
src?: string;
|
|
11
|
+
/** Accessible name. Absent, the avatar is decorative and hidden from assistive technology. */
|
|
12
|
+
alt?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const AvatarDefinition: ComponentDefinition<AvatarProps>;
|
|
15
|
+
export declare function Avatar({ name, src, alt, className, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Avatar } from "@base-ui/react/avatar";
|
|
6
|
+
//#region src/particles/avatar/avatar.tsx
|
|
7
|
+
const AvatarDefinition = defineComponent({
|
|
8
|
+
name: "Avatar",
|
|
9
|
+
importPath: "@vtex/faststore/components",
|
|
10
|
+
component: Avatar$1,
|
|
11
|
+
editor: {
|
|
12
|
+
label: "Avatar",
|
|
13
|
+
category: "content"
|
|
14
|
+
},
|
|
15
|
+
schema: {
|
|
16
|
+
name: {
|
|
17
|
+
type: "string",
|
|
18
|
+
label: "Name"
|
|
19
|
+
},
|
|
20
|
+
src: {
|
|
21
|
+
type: "string",
|
|
22
|
+
label: "Image URL"
|
|
23
|
+
},
|
|
24
|
+
alt: {
|
|
25
|
+
type: "string",
|
|
26
|
+
label: "Alt Text"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
guideline: "A person or account marker: an image with an initials fallback derived from `name`. Decorative unless `alt` is set, so give it an `alt` whenever no adjacent text names the person. Style it through data-fs-avatar."
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* The first code point of the first and last words of `name`, uppercased. One word yields one initial,
|
|
33
|
+
* and no words yields an empty string. Code points rather than UTF-16 units, so an astral-plane letter
|
|
34
|
+
* is not split in half.
|
|
35
|
+
*/
|
|
36
|
+
function getAvatarInitials(name) {
|
|
37
|
+
const words = name.trim().split(/\s+/).filter(Boolean);
|
|
38
|
+
const first = words[0];
|
|
39
|
+
const last = words.at(-1);
|
|
40
|
+
if (first === void 0 || last === void 0) return "";
|
|
41
|
+
const initial = (word) => Array.from(word)[0] ?? "";
|
|
42
|
+
return (words.length === 1 ? initial(first) : initial(first) + initial(last)).toLocaleUpperCase();
|
|
43
|
+
}
|
|
44
|
+
function Avatar$1({ name = "", src, alt, className, ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsxs(Avatar.Root, {
|
|
46
|
+
...props,
|
|
47
|
+
className,
|
|
48
|
+
role: alt ? "img" : void 0,
|
|
49
|
+
"aria-label": alt || void 0,
|
|
50
|
+
"aria-hidden": alt ? void 0 : true,
|
|
51
|
+
"data-fs-avatar": "",
|
|
52
|
+
children: [src ? /* @__PURE__ */ jsx(Avatar.Image, {
|
|
53
|
+
src,
|
|
54
|
+
alt: "",
|
|
55
|
+
"data-fs-avatar-image": ""
|
|
56
|
+
}) : null, /* @__PURE__ */ jsx(Avatar.Fallback, {
|
|
57
|
+
"data-fs-avatar-fallback": "",
|
|
58
|
+
children: getAvatarInitials(name)
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { Avatar$1 as Avatar, AvatarDefinition, getAvatarInitials };
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.js","names":["Avatar","BaseAvatar"],"sources":["../../../src/particles/avatar/avatar.tsx"],"sourcesContent":["'use client';\n\nimport { Avatar as BaseAvatar } from '@base-ui/react/avatar';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef } from 'react';\n\n/** Props for {@link Avatar}. Extends the native `<span>` attributes, minus `children`. */\nexport type AvatarProps = Omit<ComponentPropsWithRef<'span'>, 'children'> & {\n /** Whose avatar this is. The initials derive from it. */\n name?: string;\n /** Image URL. Absent or empty, the initials show. */\n src?: string;\n /** Accessible name. Absent, the avatar is decorative and hidden from assistive technology. */\n alt?: string;\n};\n\nexport const AvatarDefinition = defineComponent<AvatarProps>({\n name: 'Avatar',\n importPath: '@vtex/faststore/components',\n component: Avatar,\n editor: { label: 'Avatar', category: 'content' },\n schema: {\n name: { type: 'string', label: 'Name' },\n src: { type: 'string', label: 'Image URL' },\n alt: { type: 'string', label: 'Alt Text' },\n },\n guideline:\n 'A person or account marker: an image with an initials fallback derived from `name`. Decorative unless `alt` is set, so give it an `alt` whenever no adjacent text names the person. Style it through data-fs-avatar.',\n});\n\n/**\n * The first code point of the first and last words of `name`, uppercased. One word yields one initial,\n * and no words yields an empty string. Code points rather than UTF-16 units, so an astral-plane letter\n * is not split in half.\n */\nexport function getAvatarInitials(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n const first = words[0];\n const last = words.at(-1);\n if (first === undefined || last === undefined) {\n return '';\n }\n\n const initial = (word: string) => Array.from(word)[0] ?? '';\n const initials = words.length === 1 ? initial(first) : initial(first) + initial(last);\n return initials.toLocaleUpperCase();\n}\n\nexport function Avatar({ name = '', src, alt, className, ...props }: AvatarProps) {\n return (\n <BaseAvatar.Root\n {...props}\n className={className}\n role={alt ? 'img' : undefined}\n aria-label={alt || undefined}\n aria-hidden={alt ? undefined : true}\n data-fs-avatar=\"\"\n >\n {src ? <BaseAvatar.Image src={src} alt=\"\" data-fs-avatar-image=\"\" /> : null}\n <BaseAvatar.Fallback data-fs-avatar-fallback=\"\">{getAvatarInitials(name)}</BaseAvatar.Fallback>\n </BaseAvatar.Root>\n );\n}\n"],"mappings":";;;;;;AAgBA,MAAa,mBAAmB,gBAA6B;CAC3D,MAAM;CACN,YAAY;CACZ,WAAWA;CACX,QAAQ;EAAE,OAAO;EAAU,UAAU;CAAU;CAC/C,QAAQ;EACN,MAAM;GAAE,MAAM;GAAU,OAAO;EAAO;EACtC,KAAK;GAAE,MAAM;GAAU,OAAO;EAAY;EAC1C,KAAK;GAAE,MAAM;GAAU,OAAO;EAAW;CAC3C;CACA,WACE;AACJ,CAAC;;;;;;AAOD,SAAgB,kBAAkB,MAAsB;CACtD,MAAM,QAAQ,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO;CACrD,MAAM,QAAQ,MAAM;CACpB,MAAM,OAAO,MAAM,GAAG,EAAE;CACxB,IAAI,UAAU,KAAA,KAAa,SAAS,KAAA,GAClC,OAAO;CAGT,MAAM,WAAW,SAAiB,MAAM,KAAK,IAAI,CAAC,CAAC,MAAM;CAEzD,QADiB,MAAM,WAAW,IAAI,QAAQ,KAAK,IAAI,QAAQ,KAAK,IAAI,QAAQ,IAAI,EAAA,CACpE,kBAAkB;AACpC;AAEA,SAAgBA,SAAO,EAAE,OAAO,IAAI,KAAK,KAAK,WAAW,GAAG,SAAsB;CAChF,OACE,qBAACC,OAAW,MAAZ;EACE,GAAI;EACO;EACX,MAAM,MAAM,QAAQ,KAAA;EACpB,cAAY,OAAO,KAAA;EACnB,eAAa,MAAM,KAAA,IAAY;EAC/B,kBAAe;EANjB,UAAA,CAQG,MAAM,oBAACA,OAAW,OAAZ;GAAuB;GAAK,KAAI;GAAG,wBAAqB;EAAI,CAAA,IAAI,MACvE,oBAACA,OAAW,UAAZ;GAAqB,2BAAwB;GAAI,UAAA,kBAAkB,IAAI;EAAuB,CAAA,CAC/E;;AAErB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { ReactNode, Ref } from "react";
|
|
4
|
+
//#region src/particles/copy-text/copy-text.d.ts
|
|
5
|
+
export type CopyTextOutcome = 'idle' | 'pending' | 'success' | 'failure';
|
|
6
|
+
export type CopyTextProps = Readonly<{
|
|
7
|
+
text: string;
|
|
8
|
+
accessibleName?: string;
|
|
9
|
+
successMessage?: string;
|
|
10
|
+
failureMessage?: string;
|
|
11
|
+
dismissLabel?: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
ref?: Ref<HTMLSpanElement>;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const CopyTextDefinition: ComponentDefinition<Readonly<{
|
|
17
|
+
text: string;
|
|
18
|
+
accessibleName?: string;
|
|
19
|
+
successMessage?: string;
|
|
20
|
+
failureMessage?: string;
|
|
21
|
+
dismissLabel?: string;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
ref?: Ref<HTMLSpanElement>;
|
|
25
|
+
}>>;
|
|
26
|
+
export declare function CopyText({ text, accessibleName, successMessage, failureMessage, dismissLabel, children, className, ref }: CopyTextProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
//#endregion
|
|
28
|
+
//# sourceMappingURL=copy-text.d.ts.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { useIntl } from "../../sdk/i18n/client.js";
|
|
5
|
+
import { Button } from "../button/button.js";
|
|
6
|
+
import { useEffect, useRef, useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/particles/copy-text/copy-text.tsx
|
|
9
|
+
const CLEAR_AFTER_MS = 5e3;
|
|
10
|
+
function isBlank(text) {
|
|
11
|
+
return text.trim().length === 0;
|
|
12
|
+
}
|
|
13
|
+
const CopyTextDefinition = defineComponent({
|
|
14
|
+
name: "CopyText",
|
|
15
|
+
importPath: "@vtex/faststore/components",
|
|
16
|
+
component: CopyText,
|
|
17
|
+
editor: {
|
|
18
|
+
label: "Copy Text",
|
|
19
|
+
category: "action"
|
|
20
|
+
},
|
|
21
|
+
schema: {
|
|
22
|
+
accessibleName: {
|
|
23
|
+
type: "string",
|
|
24
|
+
default: "Copy",
|
|
25
|
+
label: "Accessible name"
|
|
26
|
+
},
|
|
27
|
+
successMessage: {
|
|
28
|
+
type: "string",
|
|
29
|
+
default: "Copied",
|
|
30
|
+
label: "Success message"
|
|
31
|
+
},
|
|
32
|
+
failureMessage: {
|
|
33
|
+
type: "string",
|
|
34
|
+
default: "Could not copy",
|
|
35
|
+
label: "Failure message"
|
|
36
|
+
},
|
|
37
|
+
dismissLabel: {
|
|
38
|
+
type: "string",
|
|
39
|
+
default: "Dismiss",
|
|
40
|
+
label: "Dismiss label"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
guideline: "Copies the text it is given and confirms the result inline. Pass the identifier as text and the visible icon or label as children. Do not pass surrounding heading text."
|
|
44
|
+
});
|
|
45
|
+
function CopyText({ text, accessibleName, successMessage, failureMessage, dismissLabel, children, className, ref }) {
|
|
46
|
+
const intl = useIntl();
|
|
47
|
+
const name = accessibleName ?? intl.formatMessage({ id: "fs/order.copy.action" });
|
|
48
|
+
const success = successMessage ?? intl.formatMessage({ id: "fs/order.copy.copied" });
|
|
49
|
+
const failure = failureMessage ?? intl.formatMessage({ id: "fs/order.copy.failure" });
|
|
50
|
+
const dismissText = dismissLabel ?? intl.formatMessage({ id: "fs/order.copy.dismiss" });
|
|
51
|
+
const [outcome, setOutcome] = useState("idle");
|
|
52
|
+
const actionRef = useRef(null);
|
|
53
|
+
const timerRef = useRef(null);
|
|
54
|
+
const generation = useRef(0);
|
|
55
|
+
const active = useRef(true);
|
|
56
|
+
function clearTimer() {
|
|
57
|
+
if (timerRef.current === null) return;
|
|
58
|
+
clearTimeout(timerRef.current);
|
|
59
|
+
timerRef.current = null;
|
|
60
|
+
}
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
active.current = true;
|
|
63
|
+
return () => {
|
|
64
|
+
active.current = false;
|
|
65
|
+
if (timerRef.current === null) return;
|
|
66
|
+
clearTimeout(timerRef.current);
|
|
67
|
+
timerRef.current = null;
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
|
+
function scheduleClear(token) {
|
|
71
|
+
clearTimer();
|
|
72
|
+
if (!active.current) return;
|
|
73
|
+
timerRef.current = setTimeout(() => {
|
|
74
|
+
if (!active.current || generation.current !== token) return;
|
|
75
|
+
setOutcome("idle");
|
|
76
|
+
}, CLEAR_AFTER_MS);
|
|
77
|
+
}
|
|
78
|
+
async function copy() {
|
|
79
|
+
if (isBlank(text) || outcome === "pending") return;
|
|
80
|
+
const token = generation.current + 1;
|
|
81
|
+
generation.current = token;
|
|
82
|
+
clearTimer();
|
|
83
|
+
setOutcome("pending");
|
|
84
|
+
const write = navigator.clipboard?.writeText;
|
|
85
|
+
if (typeof write !== "function") {
|
|
86
|
+
if (!active.current || generation.current !== token) return;
|
|
87
|
+
setOutcome("failure");
|
|
88
|
+
scheduleClear(token);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
await write.call(navigator.clipboard, text);
|
|
93
|
+
if (!active.current || generation.current !== token) return;
|
|
94
|
+
setOutcome("success");
|
|
95
|
+
} catch {
|
|
96
|
+
if (!active.current || generation.current !== token) return;
|
|
97
|
+
setOutcome("failure");
|
|
98
|
+
}
|
|
99
|
+
scheduleClear(token);
|
|
100
|
+
}
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (outcome === "success" || outcome === "failure") actionRef.current?.focus();
|
|
103
|
+
}, [outcome]);
|
|
104
|
+
function dismiss() {
|
|
105
|
+
generation.current += 1;
|
|
106
|
+
clearTimer();
|
|
107
|
+
setOutcome("idle");
|
|
108
|
+
actionRef.current?.focus();
|
|
109
|
+
}
|
|
110
|
+
const message = outcome === "success" ? success : failure;
|
|
111
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
112
|
+
ref,
|
|
113
|
+
className,
|
|
114
|
+
"data-fs-copy-text": "",
|
|
115
|
+
"data-fs-copy-text-outcome": outcome,
|
|
116
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
117
|
+
ref: actionRef,
|
|
118
|
+
type: "button",
|
|
119
|
+
"aria-label": name,
|
|
120
|
+
"data-fs-copy-text-action": "",
|
|
121
|
+
disabled: isBlank(text) || outcome === "pending",
|
|
122
|
+
onClick: () => {
|
|
123
|
+
copy();
|
|
124
|
+
},
|
|
125
|
+
children
|
|
126
|
+
}), outcome === "success" || outcome === "failure" ? /* @__PURE__ */ jsxs("output", {
|
|
127
|
+
"data-fs-copy-text-message": "",
|
|
128
|
+
children: [message, /* @__PURE__ */ jsx(Button, {
|
|
129
|
+
type: "button",
|
|
130
|
+
"aria-label": dismissText,
|
|
131
|
+
onClick: dismiss,
|
|
132
|
+
children: dismissText
|
|
133
|
+
})]
|
|
134
|
+
}) : null]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
export { CopyText, CopyTextDefinition };
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=copy-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-text.js","names":[],"sources":["../../../src/particles/copy-text/copy-text.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { type ReactNode, type Ref, useEffect, useRef, useState } from 'react';\nimport { useIntl } from '../../sdk/i18n/client.js';\nimport { Button } from '../button/button';\n\nconst CLEAR_AFTER_MS = 5000;\n\nexport type CopyTextOutcome = 'idle' | 'pending' | 'success' | 'failure';\n\nexport type CopyTextProps = Readonly<{\n text: string;\n accessibleName?: string;\n successMessage?: string;\n failureMessage?: string;\n dismissLabel?: string;\n children?: ReactNode;\n className?: string;\n ref?: Ref<HTMLSpanElement>;\n}>;\n\nfunction isBlank(text: string): boolean {\n return text.trim().length === 0;\n}\n\nexport const CopyTextDefinition = defineComponent<CopyTextProps>({\n name: 'CopyText',\n importPath: '@vtex/faststore/components',\n component: CopyText,\n editor: { label: 'Copy Text', category: 'action' },\n schema: {\n accessibleName: { type: 'string', default: 'Copy', label: 'Accessible name' },\n successMessage: { type: 'string', default: 'Copied', label: 'Success message' },\n failureMessage: { type: 'string', default: 'Could not copy', label: 'Failure message' },\n dismissLabel: { type: 'string', default: 'Dismiss', label: 'Dismiss label' },\n },\n guideline:\n 'Copies the text it is given and confirms the result inline. Pass the identifier as text and the visible icon or label as children. Do not pass surrounding heading text.',\n});\n\nexport function CopyText({\n text,\n accessibleName,\n successMessage,\n failureMessage,\n dismissLabel,\n children,\n className,\n ref,\n}: CopyTextProps) {\n const intl = useIntl();\n const name = accessibleName ?? intl.formatMessage({ id: 'fs/order.copy.action' });\n const success = successMessage ?? intl.formatMessage({ id: 'fs/order.copy.copied' });\n const failure = failureMessage ?? intl.formatMessage({ id: 'fs/order.copy.failure' });\n const dismissText = dismissLabel ?? intl.formatMessage({ id: 'fs/order.copy.dismiss' });\n const [outcome, setOutcome] = useState<CopyTextOutcome>('idle');\n const actionRef = useRef<HTMLButtonElement>(null);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const generation = useRef(0);\n const active = useRef(true);\n\n function clearTimer() {\n if (timerRef.current === null) return;\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n\n useEffect(() => {\n active.current = true;\n return () => {\n active.current = false;\n if (timerRef.current === null) return;\n clearTimeout(timerRef.current);\n timerRef.current = null;\n };\n }, []);\n\n function scheduleClear(token: number) {\n clearTimer();\n if (!active.current) return;\n timerRef.current = setTimeout(() => {\n if (!active.current || generation.current !== token) return;\n setOutcome('idle');\n }, CLEAR_AFTER_MS);\n }\n\n async function copy() {\n if (isBlank(text) || outcome === 'pending') return;\n const token = generation.current + 1;\n generation.current = token;\n clearTimer();\n setOutcome('pending');\n\n const write = navigator.clipboard?.writeText;\n if (typeof write !== 'function') {\n if (!active.current || generation.current !== token) return;\n setOutcome('failure');\n scheduleClear(token);\n return;\n }\n\n try {\n await write.call(navigator.clipboard, text);\n if (!active.current || generation.current !== token) return;\n setOutcome('success');\n } catch {\n if (!active.current || generation.current !== token) return;\n setOutcome('failure');\n }\n scheduleClear(token);\n }\n\n // The action is disabled while pending, and a disabled control ignores focus(). Focus moves back\n // once the outcome that re-enables it has committed.\n useEffect(() => {\n if (outcome === 'success' || outcome === 'failure') {\n actionRef.current?.focus();\n }\n }, [outcome]);\n\n function dismiss() {\n generation.current += 1;\n clearTimer();\n setOutcome('idle');\n actionRef.current?.focus();\n }\n\n const message = outcome === 'success' ? success : failure;\n\n return (\n <span ref={ref} className={className} data-fs-copy-text=\"\" data-fs-copy-text-outcome={outcome}>\n <Button\n ref={actionRef}\n type=\"button\"\n aria-label={name}\n data-fs-copy-text-action=\"\"\n disabled={isBlank(text) || outcome === 'pending'}\n onClick={() => {\n void copy();\n }}\n >\n {children}\n </Button>\n {outcome === 'success' || outcome === 'failure' ? (\n <output data-fs-copy-text-message=\"\">\n {message}\n <Button type=\"button\" aria-label={dismissText} onClick={dismiss}>\n {dismissText}\n </Button>\n </output>\n ) : null}\n </span>\n );\n}\n"],"mappings":";;;;;;;;AAOA,MAAM,iBAAiB;AAevB,SAAS,QAAQ,MAAuB;CACtC,OAAO,KAAK,KAAK,CAAC,CAAC,WAAW;AAChC;AAEA,MAAa,qBAAqB,gBAA+B;CAC/D,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAa,UAAU;CAAS;CACjD,QAAQ;EACN,gBAAgB;GAAE,MAAM;GAAU,SAAS;GAAQ,OAAO;EAAkB;EAC5E,gBAAgB;GAAE,MAAM;GAAU,SAAS;GAAU,OAAO;EAAkB;EAC9E,gBAAgB;GAAE,MAAM;GAAU,SAAS;GAAkB,OAAO;EAAkB;EACtF,cAAc;GAAE,MAAM;GAAU,SAAS;GAAW,OAAO;EAAgB;CAC7E;CACA,WACE;AACJ,CAAC;AAED,SAAgB,SAAS,EACvB,MACA,gBACA,gBACA,gBACA,cACA,UACA,WACA,OACgB;CAChB,MAAM,OAAO,QAAQ;CACrB,MAAM,OAAO,kBAAkB,KAAK,cAAc,EAAE,IAAI,uBAAuB,CAAC;CAChF,MAAM,UAAU,kBAAkB,KAAK,cAAc,EAAE,IAAI,uBAAuB,CAAC;CACnF,MAAM,UAAU,kBAAkB,KAAK,cAAc,EAAE,IAAI,wBAAwB,CAAC;CACpF,MAAM,cAAc,gBAAgB,KAAK,cAAc,EAAE,IAAI,wBAAwB,CAAC;CACtF,MAAM,CAAC,SAAS,cAAc,SAA0B,MAAM;CAC9D,MAAM,YAAY,OAA0B,IAAI;CAChD,MAAM,WAAW,OAA6C,IAAI;CAClE,MAAM,aAAa,OAAO,CAAC;CAC3B,MAAM,SAAS,OAAO,IAAI;CAE1B,SAAS,aAAa;EACpB,IAAI,SAAS,YAAY,MAAM;EAC/B,aAAa,SAAS,OAAO;EAC7B,SAAS,UAAU;CACrB;CAEA,gBAAgB;EACd,OAAO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AAU,QAAQ,IAAI,KAAK,YAAY;GACvC,eAAe;IACb,KAAU;GACZ;GAEC;EACK,CAAA,GACP,YAAY,aAAa,YAAY,YACpC,qBAAC,UAAD;GAAQ,6BAA0B;GAAlC,UAAA,CACG,SACD,oBAAC,QAAD;IAAQ,MAAK;IAAS,cAAY;IAAa,SAAS;IACrD,UAAA;GACK,CAAA,CACF;EACN,CAAA,IAAA,IACA;;AAEV"}
|
|
@@ -3,13 +3,18 @@ import "../../core/dist/index.js";
|
|
|
3
3
|
import { applyMask } from "../shared/input-mask.js";
|
|
4
4
|
import { ComponentPropsWithRef, FocusEvent, ReactNode, Ref } from "react";
|
|
5
5
|
//#region src/particles/document-field/document-field.d.ts
|
|
6
|
-
export type DocumentType = 'CPF';
|
|
6
|
+
export type DocumentType = 'CPF' | 'SSN' | 'SIN' | 'RFC';
|
|
7
7
|
type DocumentFieldRequirement = 'mandatory' | 'optional';
|
|
8
8
|
export type DocumentSpec = {
|
|
9
9
|
id: DocumentType;
|
|
10
10
|
name: string;
|
|
11
11
|
mask: string;
|
|
12
|
+
placeholder: string;
|
|
13
|
+
/** Strips what the type never holds, before the mask runs. */
|
|
14
|
+
sanitize: (raw: string) => string;
|
|
12
15
|
validate: (value: string) => boolean;
|
|
16
|
+
/** `'off'` for SSN and SIN, absent for CPF and RFC (Decision 9). */
|
|
17
|
+
autoComplete?: 'off';
|
|
13
18
|
};
|
|
14
19
|
export type DocumentFieldProps = Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'value' | 'onChange' | 'onBlur' | 'ref' | 'dangerouslySetInnerHTML'> & {
|
|
15
20
|
/** Unused on the bound path — react-hook-form owns the value. */
|
|
@@ -54,9 +59,33 @@ export type DocumentFieldProps = Omit<ComponentPropsWithRef<'div'>, 'defaultValu
|
|
|
54
59
|
* digits. Runs on blur/submit only, never per keystroke.
|
|
55
60
|
*/
|
|
56
61
|
export declare function validateCPF(value: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* SSN validation, ported from `@vtex/country-forms` 1.2.0 (measured 2026-10-16). Strips non-digits,
|
|
64
|
+
* requires exactly 9 digits, refuses area `000`, `666` and `>= 900`, group `00` and serial `0000`.
|
|
65
|
+
*/
|
|
66
|
+
export declare function validateSSN(value: string): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* SIN validation, ported from `@vtex/country-forms` 1.2.0 (measured 2026-10-16). Strips non-digits,
|
|
69
|
+
* requires exactly 9 digits, refuses all zeros, and verifies the Luhn check.
|
|
70
|
+
*/
|
|
71
|
+
export declare function validateSIN(value: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* RFC (individual) validation, ported from `@vtex/country-forms` 1.2.0 (measured 2026-10-16): after
|
|
74
|
+
* uppercasing and stripping every non A-Z0-9 character it is four letters, six digits and three
|
|
75
|
+
* letters or digits, and characters 5-10 read as a plausible month (1-12) and day (1-31). The day check
|
|
76
|
+
* is not calendar-aware, as in the library. The library's set of refused four-letter prefixes is not
|
|
77
|
+
* carried (the structure and the date are what a typo breaks).
|
|
78
|
+
*/
|
|
79
|
+
export declare function validateRFC(value: string): boolean;
|
|
57
80
|
export declare const DOCUMENTS: Record<DocumentType, DocumentSpec>;
|
|
58
81
|
/**
|
|
59
|
-
*
|
|
82
|
+
* Turns the API's lower-case document id (`Payment.countries[].documents[].type`) into this table's key,
|
|
83
|
+
* or `null` for anything else, including a business document, a prototype key and a non-string.
|
|
84
|
+
*/
|
|
85
|
+
export declare function documentTypeFromId(id: unknown): DocumentType | null;
|
|
86
|
+
/**
|
|
87
|
+
* True when `type` is one of the table's upper-case keys (`CPF`, `SSN`, `SIN`, `RFC`); the API's lower-case
|
|
88
|
+
* ids go through `documentTypeFromId`. Lets a host gate the field by locale.
|
|
60
89
|
*
|
|
61
90
|
* `Object.hasOwn`, not the `in` operator: `in` walks the prototype chain, so `constructor`,
|
|
62
91
|
* `__proto__` and `toString` all satisfied it and were then trusted as a `DocumentType` by callers
|
|
@@ -66,9 +95,9 @@ export declare const DOCUMENTS: Record<DocumentType, DocumentSpec>;
|
|
|
66
95
|
*/
|
|
67
96
|
export declare function isSupportedDocumentType(type: unknown): type is DocumentType;
|
|
68
97
|
/**
|
|
69
|
-
* Apply a document type's mask to raw input:
|
|
70
|
-
*
|
|
71
|
-
*
|
|
98
|
+
* Apply a document type's mask to raw input: run the type's sanitiser, then truncate to the mask's slot
|
|
99
|
+
* count so excess characters never trail past the mask (e.g. a 15-digit paste into the 11-slot CPF mask
|
|
100
|
+
* yields `111.444.777-35`, not `111.444.777-358888`).
|
|
72
101
|
*/
|
|
73
102
|
export declare function maskDocumentValue(rawValue: string, documentType: DocumentType): string;
|
|
74
103
|
/**
|