@vtex/faststore 0.0.1
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 +18 -0
- package/LICENSE +21 -0
- package/README.md +95 -0
- package/dist/actions.json +334 -0
- package/dist/catalog.json +6615 -0
- package/dist/client.d.ts +17 -0
- package/dist/client.js +8 -0
- package/dist/components.d.ts +87 -0
- package/dist/components.js +87 -0
- package/dist/content-types.json +684 -0
- package/dist/core/dist/actions/mock-action.d.ts +24 -0
- package/dist/core/dist/actions/mock-action.js +28 -0
- package/dist/core/dist/actions/mock-action.js.map +1 -0
- package/dist/core/dist/actions/registry.d.ts +24 -0
- package/dist/core/dist/actions/registry.js +28 -0
- package/dist/core/dist/actions/registry.js.map +1 -0
- package/dist/core/dist/define-component.d.ts +100 -0
- package/dist/core/dist/define-component.js +8 -0
- package/dist/core/dist/define-component.js.map +1 -0
- package/dist/core/dist/define-content-type.d.ts +95 -0
- package/dist/core/dist/define-content-type.js +283 -0
- package/dist/core/dist/define-content-type.js.map +1 -0
- package/dist/core/dist/index.d.ts +7 -0
- package/dist/core/dist/index.js +5 -0
- package/dist/core/dist/schema/generated/schema.d.ts +28 -0
- package/dist/core/dist/types.d.ts +1 -0
- package/dist/docs/access-code-field.md +100 -0
- package/dist/docs/access-code-sign-in.md +174 -0
- package/dist/docs/account-entry-point.md +155 -0
- package/dist/docs/address-summary.md +50 -0
- package/dist/docs/buy-button.md +162 -0
- package/dist/docs/carousel.md +105 -0
- package/dist/docs/cart-item.md +162 -0
- package/dist/docs/cart-totalizer.md +197 -0
- package/dist/docs/cart.md +495 -0
- package/dist/docs/client-preferences.md +184 -0
- package/dist/docs/client-profile-form.md +192 -0
- package/dist/docs/client-profile.md +117 -0
- package/dist/docs/container.md +97 -0
- package/dist/docs/document-field.md +97 -0
- package/dist/docs/email-field.md +93 -0
- package/dist/docs/email-identification.md +102 -0
- package/dist/docs/footer-copyright.md +112 -0
- package/dist/docs/footer-link-group.md +162 -0
- package/dist/docs/footer-root.md +145 -0
- package/dist/docs/footer-social.md +151 -0
- package/dist/docs/free-shipping-progress.md +87 -0
- package/dist/docs/gallery.md +84 -0
- package/dist/docs/header-root.md +150 -0
- package/dist/docs/identity-edit.md +88 -0
- package/dist/docs/identity-summary.md +106 -0
- package/dist/docs/incentives.md +151 -0
- package/dist/docs/logo.md +135 -0
- package/dist/docs/meter.md +67 -0
- package/dist/docs/navigation-link-list.md +171 -0
- package/dist/docs/navigation-link.md +163 -0
- package/dist/docs/navigation-menu.md +264 -0
- package/dist/docs/payment-methods.md +139 -0
- package/dist/docs/phone-field.md +106 -0
- package/dist/docs/postal-code-field.md +126 -0
- package/dist/docs/pricing.md +499 -0
- package/dist/docs/product-gallery.md +409 -0
- package/dist/docs/product-information.md +295 -0
- package/dist/docs/product-list.md +170 -0
- package/dist/docs/product-quantity.md +88 -0
- package/dist/docs/product-shelf.md +141 -0
- package/dist/docs/promotion.md +109 -0
- package/dist/docs/region.md +225 -0
- package/dist/docs/session.md +123 -0
- package/dist/docs/shipping-address.md +390 -0
- package/dist/docs/shipping-simulator.md +147 -0
- package/dist/docs/sign-in-form.md +117 -0
- package/dist/docs/tabs.md +176 -0
- package/dist/docs/toast.md +124 -0
- package/dist/docs/variant-selector.md +450 -0
- package/dist/graphql/define-subgraph.d.ts +12 -0
- package/dist/graphql/define-subgraph.js +15 -0
- package/dist/graphql/define-subgraph.js.map +1 -0
- package/dist/graphql/gql.d.ts +10 -0
- package/dist/graphql/gql.js +16 -0
- package/dist/graphql/gql.js.map +1 -0
- package/dist/graphql/types.d.ts +88 -0
- package/dist/graphql.d.ts +4 -0
- package/dist/graphql.js +3 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +5 -0
- package/dist/internal/client.d.ts +24 -0
- package/dist/internal/client.js +23 -0
- package/dist/internal/content.d.ts +2 -0
- package/dist/internal/content.js +2 -0
- package/dist/internal/server.d.ts +7 -0
- package/dist/internal/server.js +6 -0
- package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +111 -0
- package/dist/matter/access-code-sign-in/access-code-sign-in.js +387 -0
- package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -0
- package/dist/matter/account-entry-point/account-entry-point.d.ts +64 -0
- package/dist/matter/account-entry-point/account-entry-point.js +151 -0
- package/dist/matter/account-entry-point/account-entry-point.js.map +1 -0
- package/dist/matter/breadcrumb/breadcrumb.d.ts +40 -0
- package/dist/matter/breadcrumb/breadcrumb.js +155 -0
- package/dist/matter/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/matter/buy-button/buy-button.d.ts +95 -0
- package/dist/matter/buy-button/buy-button.js +259 -0
- package/dist/matter/buy-button/buy-button.js.map +1 -0
- package/dist/matter/cart/cart-namespace.d.ts +48 -0
- package/dist/matter/cart/cart-namespace.js +50 -0
- package/dist/matter/cart/cart-namespace.js.map +1 -0
- package/dist/matter/cart/cart.d.ts +312 -0
- package/dist/matter/cart/cart.js +1034 -0
- package/dist/matter/cart/cart.js.map +1 -0
- package/dist/matter/cart-item/cart-item.d.ts +103 -0
- package/dist/matter/cart-item/cart-item.js +672 -0
- package/dist/matter/cart-item/cart-item.js.map +1 -0
- package/dist/matter/cart-item-compositions/cart-item-compositions.d.ts +49 -0
- package/dist/matter/cart-item-compositions/cart-item-compositions.js +165 -0
- package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -0
- package/dist/matter/cart-item-customizations/cart-item-customizations.d.ts +28 -0
- package/dist/matter/cart-item-customizations/cart-item-customizations.js +73 -0
- package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -0
- package/dist/matter/cart-item-discounts/cart-item-discounts.d.ts +33 -0
- package/dist/matter/cart-item-discounts/cart-item-discounts.js +70 -0
- package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -0
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.d.ts +24 -0
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +54 -0
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -0
- package/dist/matter/cart-item-variations/cart-item-variations.d.ts +27 -0
- package/dist/matter/cart-item-variations/cart-item-variations.js +69 -0
- package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -0
- package/dist/matter/cart-totalizer/cart-totalizer.d.ts +78 -0
- package/dist/matter/cart-totalizer/cart-totalizer.js +220 -0
- package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -0
- package/dist/matter/client-preferences/client-preferences.d.ts +50 -0
- package/dist/matter/client-preferences/client-preferences.js +206 -0
- package/dist/matter/client-preferences/client-preferences.js.map +1 -0
- package/dist/matter/client-profile/client-profile.d.ts +59 -0
- package/dist/matter/client-profile/client-profile.js +185 -0
- package/dist/matter/client-profile/client-profile.js.map +1 -0
- package/dist/matter/client-profile-form/client-profile-form.d.ts +126 -0
- package/dist/matter/client-profile-form/client-profile-form.js +660 -0
- package/dist/matter/client-profile-form/client-profile-form.js.map +1 -0
- package/dist/matter/delivery-options/delivery-options-accordion.d.ts +30 -0
- package/dist/matter/delivery-options/delivery-options-accordion.js +189 -0
- package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -0
- package/dist/matter/delivery-options/delivery-options-controller.d.ts +49 -0
- package/dist/matter/delivery-options/delivery-options-controller.js +203 -0
- package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -0
- package/dist/matter/delivery-options/delivery-options.d.ts +31 -0
- package/dist/matter/delivery-options/delivery-options.js +103 -0
- package/dist/matter/delivery-options/delivery-options.js.map +1 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +9 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.js +76 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -0
- package/dist/matter/email-identification/email-identification.d.ts +37 -0
- package/dist/matter/email-identification/email-identification.js +111 -0
- package/dist/matter/email-identification/email-identification.js.map +1 -0
- package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +44 -0
- package/dist/matter/free-shipping-progress/free-shipping-progress.js +170 -0
- package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -0
- package/dist/matter/identity-edit/identity-edit.d.ts +52 -0
- package/dist/matter/identity-edit/identity-edit.js +148 -0
- package/dist/matter/identity-edit/identity-edit.js.map +1 -0
- package/dist/matter/identity-summary/identity-summary.d.ts +128 -0
- package/dist/matter/identity-summary/identity-summary.js +344 -0
- package/dist/matter/identity-summary/identity-summary.js.map +1 -0
- package/dist/matter/pricing/pricing.d.ts +162 -0
- package/dist/matter/pricing/pricing.js +793 -0
- package/dist/matter/pricing/pricing.js.map +1 -0
- package/dist/matter/product-gallery/product-gallery.d.ts +23 -0
- package/dist/matter/product-gallery/product-gallery.js +188 -0
- package/dist/matter/product-gallery/product-gallery.js.map +1 -0
- package/dist/matter/product-information/product-information.d.ts +61 -0
- package/dist/matter/product-information/product-information.js +355 -0
- package/dist/matter/product-information/product-information.js.map +1 -0
- package/dist/matter/product-list/product-list.d.ts +86 -0
- package/dist/matter/product-list/product-list.js +342 -0
- package/dist/matter/product-list/product-list.js.map +1 -0
- package/dist/matter/product-quantity/product-quantity.d.ts +50 -0
- package/dist/matter/product-quantity/product-quantity.js +111 -0
- package/dist/matter/product-quantity/product-quantity.js.map +1 -0
- package/dist/matter/product-shelf/product-shelf.d.ts +125 -0
- package/dist/matter/product-shelf/product-shelf.js +376 -0
- package/dist/matter/product-shelf/product-shelf.js.map +1 -0
- package/dist/matter/region/region.d.ts +211 -0
- package/dist/matter/region/region.js +579 -0
- package/dist/matter/region/region.js.map +1 -0
- package/dist/matter/session/session.d.ts +58 -0
- package/dist/matter/session/session.js +112 -0
- package/dist/matter/session/session.js.map +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +101 -0
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -0
- package/dist/matter/shipping-address/shipping-address.d.ts +284 -0
- package/dist/matter/shipping-address/shipping-address.js +1036 -0
- package/dist/matter/shipping-address/shipping-address.js.map +1 -0
- package/dist/matter/shipping-simulator/shipping-simulator.d.ts +143 -0
- package/dist/matter/shipping-simulator/shipping-simulator.js +644 -0
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -0
- package/dist/matter/sign-in-form/sign-in-form.d.ts +79 -0
- package/dist/matter/sign-in-form/sign-in-form.js +226 -0
- package/dist/matter/sign-in-form/sign-in-form.js.map +1 -0
- package/dist/matter/variant-selector/variant-selector.d.ts +183 -0
- package/dist/matter/variant-selector/variant-selector.js +840 -0
- package/dist/matter/variant-selector/variant-selector.js.map +1 -0
- package/dist/message-locales.json +7 -0
- package/dist/particles/access-code-field/access-code-field.d.ts +33 -0
- package/dist/particles/access-code-field/access-code-field.js +95 -0
- package/dist/particles/access-code-field/access-code-field.js.map +1 -0
- package/dist/particles/accordion/accordion.d.ts +45 -0
- package/dist/particles/accordion/accordion.js +156 -0
- package/dist/particles/accordion/accordion.js.map +1 -0
- package/dist/particles/address-summary/address-summary.d.ts +50 -0
- package/dist/particles/address-summary/address-summary.js +129 -0
- package/dist/particles/address-summary/address-summary.js.map +1 -0
- package/dist/particles/badge/badge.d.ts +10 -0
- package/dist/particles/badge/badge.js +27 -0
- package/dist/particles/badge/badge.js.map +1 -0
- package/dist/particles/button/button.d.ts +18 -0
- package/dist/particles/button/button.js +37 -0
- package/dist/particles/button/button.js.map +1 -0
- package/dist/particles/carousel/carousel.d.ts +60 -0
- package/dist/particles/carousel/carousel.js +335 -0
- package/dist/particles/carousel/carousel.js.map +1 -0
- package/dist/particles/checkbox/checkbox.d.ts +40 -0
- package/dist/particles/checkbox/checkbox.js +82 -0
- package/dist/particles/checkbox/checkbox.js.map +1 -0
- package/dist/particles/container/container.d.ts +20 -0
- package/dist/particles/container/container.js +36 -0
- package/dist/particles/container/container.js.map +1 -0
- package/dist/particles/dialog/dialog.d.ts +54 -0
- package/dist/particles/dialog/dialog.js +192 -0
- package/dist/particles/dialog/dialog.js.map +1 -0
- package/dist/particles/document-field/document-field.d.ts +61 -0
- package/dist/particles/document-field/document-field.js +146 -0
- package/dist/particles/document-field/document-field.js.map +1 -0
- package/dist/particles/drawer/drawer.d.ts +52 -0
- package/dist/particles/drawer/drawer.js +183 -0
- package/dist/particles/drawer/drawer.js.map +1 -0
- package/dist/particles/email-field/email-field.d.ts +37 -0
- package/dist/particles/email-field/email-field.js +106 -0
- package/dist/particles/email-field/email-field.js.map +1 -0
- package/dist/particles/field/field.d.ts +50 -0
- package/dist/particles/field/field.js +133 -0
- package/dist/particles/field/field.js.map +1 -0
- package/dist/particles/fieldset/fieldset.d.ts +16 -0
- package/dist/particles/fieldset/fieldset.js +52 -0
- package/dist/particles/fieldset/fieldset.js.map +1 -0
- package/dist/particles/footer-copyright/footer-copyright.d.ts +32 -0
- package/dist/particles/footer-copyright/footer-copyright.js +50 -0
- package/dist/particles/footer-copyright/footer-copyright.js.map +1 -0
- package/dist/particles/footer-link-group/footer-link-group.d.ts +66 -0
- package/dist/particles/footer-link-group/footer-link-group.js +154 -0
- package/dist/particles/footer-link-group/footer-link-group.js.map +1 -0
- package/dist/particles/footer-root/footer-root.d.ts +21 -0
- package/dist/particles/footer-root/footer-root.js +38 -0
- package/dist/particles/footer-root/footer-root.js.map +1 -0
- package/dist/particles/footer-social/footer-social.d.ts +79 -0
- package/dist/particles/footer-social/footer-social.js +176 -0
- package/dist/particles/footer-social/footer-social.js.map +1 -0
- package/dist/particles/gallery/gallery.d.ts +181 -0
- package/dist/particles/gallery/gallery.js +920 -0
- package/dist/particles/gallery/gallery.js.map +1 -0
- package/dist/particles/header-root/header-root.d.ts +21 -0
- package/dist/particles/header-root/header-root.js +38 -0
- package/dist/particles/header-root/header-root.js.map +1 -0
- package/dist/particles/icon/icon.d.ts +22 -0
- package/dist/particles/icon/icon.js +48 -0
- package/dist/particles/icon/icon.js.map +1 -0
- package/dist/particles/image/image.d.ts +13 -0
- package/dist/particles/image/image.js +59 -0
- package/dist/particles/image/image.js.map +1 -0
- package/dist/particles/incentives/incentives.d.ts +85 -0
- package/dist/particles/incentives/incentives.js +200 -0
- package/dist/particles/incentives/incentives.js.map +1 -0
- package/dist/particles/input/input.d.ts +9 -0
- package/dist/particles/input/input.js +28 -0
- package/dist/particles/input/input.js.map +1 -0
- package/dist/particles/logo/logo.d.ts +55 -0
- package/dist/particles/logo/logo.js +96 -0
- package/dist/particles/logo/logo.js.map +1 -0
- package/dist/particles/menu/menu.d.ts +103 -0
- package/dist/particles/menu/menu.js +409 -0
- package/dist/particles/menu/menu.js.map +1 -0
- package/dist/particles/menubar/menubar.d.ts +18 -0
- package/dist/particles/menubar/menubar.js +42 -0
- package/dist/particles/menubar/menubar.js.map +1 -0
- package/dist/particles/meter/meter.d.ts +36 -0
- package/dist/particles/meter/meter.js +132 -0
- package/dist/particles/meter/meter.js.map +1 -0
- package/dist/particles/navigation-link/navigation-link.d.ts +43 -0
- package/dist/particles/navigation-link/navigation-link.js +82 -0
- package/dist/particles/navigation-link/navigation-link.js.map +1 -0
- package/dist/particles/navigation-link-list/navigation-link-list.d.ts +59 -0
- package/dist/particles/navigation-link-list/navigation-link-list.js +103 -0
- package/dist/particles/navigation-link-list/navigation-link-list.js.map +1 -0
- package/dist/particles/navigation-menu/navigation-menu.d.ts +78 -0
- package/dist/particles/navigation-menu/navigation-menu.js +295 -0
- package/dist/particles/navigation-menu/navigation-menu.js.map +1 -0
- package/dist/particles/number-field/number-field.d.ts +46 -0
- package/dist/particles/number-field/number-field.js +169 -0
- package/dist/particles/number-field/number-field.js.map +1 -0
- package/dist/particles/password-field/password-field.d.ts +31 -0
- package/dist/particles/password-field/password-field.js +109 -0
- package/dist/particles/password-field/password-field.js.map +1 -0
- package/dist/particles/payment-methods/payment-methods.d.ts +72 -0
- package/dist/particles/payment-methods/payment-methods.js +151 -0
- package/dist/particles/payment-methods/payment-methods.js.map +1 -0
- package/dist/particles/phone-field/phone-field.d.ts +67 -0
- package/dist/particles/phone-field/phone-field.js +250 -0
- package/dist/particles/phone-field/phone-field.js.map +1 -0
- package/dist/particles/popover/popover.d.ts +68 -0
- package/dist/particles/popover/popover.js +284 -0
- package/dist/particles/popover/popover.js.map +1 -0
- package/dist/particles/postal-code-field/postal-code-field.d.ts +75 -0
- package/dist/particles/postal-code-field/postal-code-field.js +169 -0
- package/dist/particles/postal-code-field/postal-code-field.js.map +1 -0
- package/dist/particles/promotion/promotion.d.ts +46 -0
- package/dist/particles/promotion/promotion.js +78 -0
- package/dist/particles/promotion/promotion.js.map +1 -0
- package/dist/particles/quantity-selector/quantity-selector.d.ts +30 -0
- package/dist/particles/quantity-selector/quantity-selector.js +116 -0
- package/dist/particles/quantity-selector/quantity-selector.js.map +1 -0
- package/dist/particles/radio/radio.d.ts +36 -0
- package/dist/particles/radio/radio.js +76 -0
- package/dist/particles/radio/radio.js.map +1 -0
- package/dist/particles/scroll-area/scroll-area.d.ts +36 -0
- package/dist/particles/scroll-area/scroll-area.js +145 -0
- package/dist/particles/scroll-area/scroll-area.js.map +1 -0
- package/dist/particles/select/select.d.ts +125 -0
- package/dist/particles/select/select.js +478 -0
- package/dist/particles/select/select.js.map +1 -0
- package/dist/particles/separator/separator.d.ts +12 -0
- package/dist/particles/separator/separator.js +33 -0
- package/dist/particles/separator/separator.js.map +1 -0
- package/dist/particles/shared/input-mask.d.ts +5 -0
- package/dist/particles/shared/input-mask.js +58 -0
- package/dist/particles/shared/input-mask.js.map +1 -0
- package/dist/particles/spinner/spinner.d.ts +13 -0
- package/dist/particles/spinner/spinner.js +31 -0
- package/dist/particles/spinner/spinner.js.map +1 -0
- package/dist/particles/switch/switch.d.ts +27 -0
- package/dist/particles/switch/switch.js +59 -0
- package/dist/particles/switch/switch.js.map +1 -0
- package/dist/particles/tabs/tabs.d.ts +45 -0
- package/dist/particles/tabs/tabs.js +164 -0
- package/dist/particles/tabs/tabs.js.map +1 -0
- package/dist/particles/text/text.d.ts +24 -0
- package/dist/particles/text/text.js +40 -0
- package/dist/particles/text/text.js.map +1 -0
- package/dist/particles/toast/toast.d.ts +83 -0
- package/dist/particles/toast/toast.js +194 -0
- package/dist/particles/toast/toast.js.map +1 -0
- package/dist/particles/toggle/toggle.d.ts +26 -0
- package/dist/particles/toggle/toggle.js +61 -0
- package/dist/particles/toggle/toggle.js.map +1 -0
- package/dist/particles/tooltip/tooltip.d.ts +61 -0
- package/dist/particles/tooltip/tooltip.js +240 -0
- package/dist/particles/tooltip/tooltip.js.map +1 -0
- package/dist/schema.graphql +2953 -0
- package/dist/sdk/actions/cart-action-provider.d.ts +19 -0
- package/dist/sdk/actions/cart-action-provider.js +23 -0
- package/dist/sdk/actions/cart-action-provider.js.map +1 -0
- package/dist/sdk/actions/identity-action-provider.d.ts +15 -0
- package/dist/sdk/actions/identity-action-provider.js +19 -0
- package/dist/sdk/actions/identity-action-provider.js.map +1 -0
- package/dist/sdk/actions/index.d.ts +7 -0
- package/dist/sdk/actions/index.js +6 -0
- package/dist/sdk/actions/inject-actions.d.ts +14 -0
- package/dist/sdk/actions/inject-actions.js +36 -0
- package/dist/sdk/actions/inject-actions.js.map +1 -0
- package/dist/sdk/actions/region-action-provider.d.ts +15 -0
- package/dist/sdk/actions/region-action-provider.js +19 -0
- package/dist/sdk/actions/region-action-provider.js.map +1 -0
- package/dist/sdk/actions/session-action-provider.d.ts +15 -0
- package/dist/sdk/actions/session-action-provider.js +19 -0
- package/dist/sdk/actions/session-action-provider.js.map +1 -0
- package/dist/sdk/actions/shipping-action-provider.d.ts +15 -0
- package/dist/sdk/actions/shipping-action-provider.js +19 -0
- package/dist/sdk/actions/shipping-action-provider.js.map +1 -0
- package/dist/sdk/actions/types.d.ts +21 -0
- package/dist/sdk/cache/storefront-cache.js +35 -0
- package/dist/sdk/cache/storefront-cache.js.map +1 -0
- package/dist/sdk/cart/operations.d.ts +31 -0
- package/dist/sdk/cart/operations.js +215 -0
- package/dist/sdk/cart/operations.js.map +1 -0
- package/dist/sdk/cart/optimistic.d.ts +24 -0
- package/dist/sdk/cart/optimistic.js +164 -0
- package/dist/sdk/cart/optimistic.js.map +1 -0
- package/dist/sdk/cart/use-cart-actions.d.ts +56 -0
- package/dist/sdk/cart/use-cart-actions.js +348 -0
- package/dist/sdk/cart/use-cart-actions.js.map +1 -0
- package/dist/sdk/cart/use-cart-validate-on-open.js +50 -0
- package/dist/sdk/cart/use-cart-validate-on-open.js.map +1 -0
- package/dist/sdk/cart/write-gate.js +54 -0
- package/dist/sdk/cart/write-gate.js.map +1 -0
- package/dist/sdk/client/assert-api-url.js +20 -0
- package/dist/sdk/client/assert-api-url.js.map +1 -0
- package/dist/sdk/client/create-client.d.ts +23 -0
- package/dist/sdk/client/create-client.js +46 -0
- package/dist/sdk/client/create-client.js.map +1 -0
- package/dist/sdk/client/fetch-page-data.d.ts +39 -0
- package/dist/sdk/client/fetch-page-data.js +33 -0
- package/dist/sdk/client/fetch-page-data.js.map +1 -0
- package/dist/sdk/client/register-preload-query.d.ts +24 -0
- package/dist/sdk/client/register-preload-query.js +33 -0
- package/dist/sdk/client/register-preload-query.js.map +1 -0
- package/dist/sdk/content/create-content-runtime.d.ts +68 -0
- package/dist/sdk/content/create-content-runtime.js +503 -0
- package/dist/sdk/content/create-content-runtime.js.map +1 -0
- package/dist/sdk/context/headers.d.ts +15 -0
- package/dist/sdk/context/headers.js +21 -0
- package/dist/sdk/context/headers.js.map +1 -0
- package/dist/sdk/context/storefront-context.d.ts +11 -0
- package/dist/sdk/context/storefront-context.js +29 -0
- package/dist/sdk/context/storefront-context.js.map +1 -0
- package/dist/sdk/data/data-override-context.d.ts +12 -0
- package/dist/sdk/data/data-override-context.js +19 -0
- package/dist/sdk/data/data-override-context.js.map +1 -0
- package/dist/sdk/data/entity-subscriber.js +28 -0
- package/dist/sdk/data/entity-subscriber.js.map +1 -0
- package/dist/sdk/data/hot-data-provider.d.ts +19 -0
- package/dist/sdk/data/hot-data-provider.js +33 -0
- package/dist/sdk/data/hot-data-provider.js.map +1 -0
- package/dist/sdk/data/index.d.ts +8 -0
- package/dist/sdk/data/index.js +8 -0
- package/dist/sdk/data/list-item-ref-context.d.ts +20 -0
- package/dist/sdk/data/list-item-ref-context.js +11 -0
- package/dist/sdk/data/list-item-ref-context.js.map +1 -0
- package/dist/sdk/data/multiple-reactive-data-provider.d.ts +32 -0
- package/dist/sdk/data/multiple-reactive-data-provider.js +20 -0
- package/dist/sdk/data/multiple-reactive-data-provider.js.map +1 -0
- package/dist/sdk/data/page-reactive-data-root.d.ts +53 -0
- package/dist/sdk/data/page-reactive-data-root.js +153 -0
- package/dist/sdk/data/page-reactive-data-root.js.map +1 -0
- package/dist/sdk/data/reactive-data-provider.d.ts +25 -0
- package/dist/sdk/data/reactive-data-provider.js +24 -0
- package/dist/sdk/data/reactive-data-provider.js.map +1 -0
- package/dist/sdk/data/reactive-list-item-data-provider.d.ts +26 -0
- package/dist/sdk/data/reactive-list-item-data-provider.js +42 -0
- package/dist/sdk/data/reactive-list-item-data-provider.js.map +1 -0
- package/dist/sdk/data/use-reactive-entity.js +40 -0
- package/dist/sdk/data/use-reactive-entity.js.map +1 -0
- package/dist/sdk/format/client.d.ts +12 -0
- package/dist/sdk/format/client.js +20 -0
- package/dist/sdk/format/client.js.map +1 -0
- package/dist/sdk/format/formatters.d.ts +32 -0
- package/dist/sdk/format/formatters.js +45 -0
- package/dist/sdk/format/formatters.js.map +1 -0
- package/dist/sdk/generated/fragment-types.js +23 -0
- package/dist/sdk/generated/fragment-types.js.map +1 -0
- package/dist/sdk/generated/gql.js +51 -0
- package/dist/sdk/generated/gql.js.map +1 -0
- package/dist/sdk/generated/graphql.d.ts +622 -0
- package/dist/sdk/generated/graphql.js +11917 -0
- package/dist/sdk/generated/graphql.js.map +1 -0
- package/dist/sdk/graphql-tag.d.ts +10 -0
- package/dist/sdk/graphql-tag.js +21 -0
- package/dist/sdk/graphql-tag.js.map +1 -0
- package/dist/sdk/i18n/client.d.ts +4 -0
- package/dist/sdk/i18n/client.js +4 -0
- package/dist/sdk/i18n/locales.d.ts +8 -0
- package/dist/sdk/i18n/locales.js +57 -0
- package/dist/sdk/i18n/locales.js.map +1 -0
- package/dist/sdk/i18n/messages/en-US.js +24 -0
- package/dist/sdk/i18n/messages/en-US.js.map +1 -0
- package/dist/sdk/i18n/messages/en-US.json +19 -0
- package/dist/sdk/i18n/messages/en-US.json.d.ts +23 -0
- package/dist/sdk/i18n/messages/es-ES.js +24 -0
- package/dist/sdk/i18n/messages/es-ES.js.map +1 -0
- package/dist/sdk/i18n/messages/es-ES.json +19 -0
- package/dist/sdk/i18n/messages/pt-BR.js +24 -0
- package/dist/sdk/i18n/messages/pt-BR.js.map +1 -0
- package/dist/sdk/i18n/messages/pt-BR.json +19 -0
- package/dist/sdk/i18n/provider.d.ts +1 -0
- package/dist/sdk/i18n/provider.js +30 -0
- package/dist/sdk/i18n/provider.js.map +1 -0
- package/dist/sdk/i18n/server.d.ts +28 -0
- package/dist/sdk/i18n/server.js +59 -0
- package/dist/sdk/i18n/server.js.map +1 -0
- package/dist/sdk/identity/operations.d.ts +34 -0
- package/dist/sdk/identity/operations.js +78 -0
- package/dist/sdk/identity/operations.js.map +1 -0
- package/dist/sdk/identity/use-identity-actions.d.ts +62 -0
- package/dist/sdk/identity/use-identity-actions.js +180 -0
- package/dist/sdk/identity/use-identity-actions.js.map +1 -0
- package/dist/sdk/provider/index.d.ts +2 -0
- package/dist/sdk/provider/index.js +2 -0
- package/dist/sdk/provider/storefront-provider.d.ts +32 -0
- package/dist/sdk/provider/storefront-provider.js +111 -0
- package/dist/sdk/provider/storefront-provider.js.map +1 -0
- package/dist/sdk/region/operations.d.ts +6 -0
- package/dist/sdk/region/region-operations.d.ts +30 -0
- package/dist/sdk/region/region-operations.js +23 -0
- package/dist/sdk/region/region-operations.js.map +1 -0
- package/dist/sdk/region/use-region-actions.d.ts +23 -0
- package/dist/sdk/region/use-region-actions.js +66 -0
- package/dist/sdk/region/use-region-actions.js.map +1 -0
- package/dist/sdk/seller.js +11 -0
- package/dist/sdk/seller.js.map +1 -0
- package/dist/sdk/session/auth-operations.d.ts +47 -0
- package/dist/sdk/session/auth-operations.js +79 -0
- package/dist/sdk/session/auth-operations.js.map +1 -0
- package/dist/sdk/session/operations.d.ts +6 -0
- package/dist/sdk/session/use-session-actions.d.ts +27 -0
- package/dist/sdk/session/use-session-actions.js +126 -0
- package/dist/sdk/session/use-session-actions.js.map +1 -0
- package/dist/sdk/shipping/cart-operations.d.ts +3 -0
- package/dist/sdk/shipping/cart-operations.js +33 -0
- package/dist/sdk/shipping/cart-operations.js.map +1 -0
- package/dist/sdk/shipping/operations.d.ts +3 -0
- package/dist/sdk/shipping/operations.js +33 -0
- package/dist/sdk/shipping/operations.js.map +1 -0
- package/dist/sdk/shipping/option-select-operations.d.ts +24 -0
- package/dist/sdk/shipping/option-select-operations.js +45 -0
- package/dist/sdk/shipping/option-select-operations.js.map +1 -0
- package/dist/sdk/shipping/request-timeout.js +41 -0
- package/dist/sdk/shipping/request-timeout.js.map +1 -0
- package/dist/sdk/shipping/shipping-operations.d.ts +38 -0
- package/dist/sdk/shipping/shipping-operations.js +77 -0
- package/dist/sdk/shipping/shipping-operations.js.map +1 -0
- package/dist/sdk/shipping/use-cart-shipping-simulation.d.ts +7 -0
- package/dist/sdk/shipping/use-cart-shipping-simulation.js +72 -0
- package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -0
- package/dist/sdk/shipping/use-shipping-actions.d.ts +27 -0
- package/dist/sdk/shipping/use-shipping-actions.js +113 -0
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -0
- package/dist/sdk/shipping/use-shipping-simulation.d.ts +7 -0
- package/dist/sdk/shipping/use-shipping-simulation.js +72 -0
- package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -0
- package/dist/sdk/state/cart.d.ts +42 -0
- package/dist/sdk/state/cart.js +64 -0
- package/dist/sdk/state/cart.js.map +1 -0
- package/dist/sdk/state/index.js +3 -0
- package/dist/sdk/state/variant-selector.d.ts +17 -0
- package/dist/sdk/state/variant-selector.js +14 -0
- package/dist/sdk/state/variant-selector.js.map +1 -0
- package/dist/utils/safe-href.js +63 -0
- package/dist/utils/safe-href.js.map +1 -0
- package/package.json +84 -0
- package/src/styles/tailwind.css +32 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { Field } from "../field/field.js";
|
|
5
|
+
import { applyMask, countSlots, isDigitOnly } from "../shared/input-mask.js";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/particles/document-field/document-field.tsx
|
|
9
|
+
/**
|
|
10
|
+
* CPF check-digit validation, ported from the legacy `validateCPF`. Strips non-digits, requires
|
|
11
|
+
* exactly 11 digits, rejects all-equal sequences (e.g. `111.111.111-11`), and verifies both check
|
|
12
|
+
* digits. Runs on blur/submit only, never per keystroke.
|
|
13
|
+
*/
|
|
14
|
+
function validateCPF(value) {
|
|
15
|
+
const digits = value.replace(/[^\d]+/g, "");
|
|
16
|
+
if (digits.length !== 11 || /(\d)\1{10}/.test(digits)) return false;
|
|
17
|
+
const values = digits.split("").map((el) => +el);
|
|
18
|
+
const rest = (count) => values.slice(0, count - 12).reduce((sum, el, index) => sum + el * (count - index), 0) * 10 % 11 % 10;
|
|
19
|
+
return rest(10) === values[9] && rest(11) === values[10];
|
|
20
|
+
}
|
|
21
|
+
const DOCUMENTS = { CPF: {
|
|
22
|
+
id: "CPF",
|
|
23
|
+
name: "CPF",
|
|
24
|
+
mask: "999.999.999-99",
|
|
25
|
+
validate: validateCPF
|
|
26
|
+
} };
|
|
27
|
+
/** True when `type` is a document type this build supports (lets a host gate the field by locale). */
|
|
28
|
+
function isSupportedDocumentType(type) {
|
|
29
|
+
return typeof type === "string" && type in DOCUMENTS;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Apply a document type's mask to raw input: strip non-digits for digit-only masks, then truncate to
|
|
33
|
+
* the mask's slot count so excess characters never trail past the mask (e.g. a 15-digit paste into
|
|
34
|
+
* the 11-slot CPF mask yields `111.444.777-35`, not `111.444.777-358888`).
|
|
35
|
+
*/
|
|
36
|
+
function maskDocumentValue(rawValue, documentType) {
|
|
37
|
+
const spec = DOCUMENTS[documentType];
|
|
38
|
+
const sanitized = isDigitOnly(spec.mask) ? rawValue.replace(/\D/g, "") : rawValue;
|
|
39
|
+
const maxSlots = Math.max(...spec.mask.split("|").map(countSlots));
|
|
40
|
+
return applyMask(sanitized.slice(0, maxSlots), spec.mask);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Check-digit validity for a document value. An **empty** value is valid (the field is optional),
|
|
44
|
+
* mirroring the legacy `validateCardholderDocument`; a non-empty value must pass the document
|
|
45
|
+
* type's check-digit validation.
|
|
46
|
+
*/
|
|
47
|
+
function isValidDocument(value, documentType) {
|
|
48
|
+
if (!value.trim()) return true;
|
|
49
|
+
return DOCUMENTS[documentType].validate(value);
|
|
50
|
+
}
|
|
51
|
+
const DocumentFieldDefinition = defineComponent({
|
|
52
|
+
name: "DocumentField",
|
|
53
|
+
importPath: "@vtex/faststore/components",
|
|
54
|
+
component: DocumentField,
|
|
55
|
+
editor: {
|
|
56
|
+
label: "Document Field",
|
|
57
|
+
category: "content"
|
|
58
|
+
},
|
|
59
|
+
schema: {
|
|
60
|
+
label: {
|
|
61
|
+
type: "string",
|
|
62
|
+
label: "Label"
|
|
63
|
+
},
|
|
64
|
+
placeholder: {
|
|
65
|
+
type: "string",
|
|
66
|
+
label: "Placeholder"
|
|
67
|
+
},
|
|
68
|
+
errorMessage: {
|
|
69
|
+
type: "string",
|
|
70
|
+
label: "Error message"
|
|
71
|
+
},
|
|
72
|
+
documentType: {
|
|
73
|
+
type: "string",
|
|
74
|
+
default: "CPF",
|
|
75
|
+
label: "Document type"
|
|
76
|
+
},
|
|
77
|
+
required: {
|
|
78
|
+
type: "boolean",
|
|
79
|
+
default: false,
|
|
80
|
+
label: "Required"
|
|
81
|
+
},
|
|
82
|
+
disabled: {
|
|
83
|
+
type: "boolean",
|
|
84
|
+
default: false,
|
|
85
|
+
label: "Disabled"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
guideline: "Presentational tax-document input composing the Field particle; applies the locale mask on change and runs check-digit validation on blur/submit. Data-agnostic (value/defaultValue/onValueChange); a host wires it to the shopper profile. CPF is optional by default."
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* Presentational tax-document input (particle). Composes the `Field` particle (`Field.Root` +
|
|
92
|
+
* `Field.Label` + `Field.Control` + `Field.Error`) and owns the locale mask (applied progressively on
|
|
93
|
+
* every change, never blocking typing) plus check-digit validation (run on blur/submit only — never
|
|
94
|
+
* per keystroke). An empty value is valid (the field is optional). It surfaces `errorMessage` inline
|
|
95
|
+
* when the check digit fails or when the host forces `invalid` (e.g. a server error surfaced by the
|
|
96
|
+
* form that owns the write). It consumes no GraphQL and no domain context — value flows through
|
|
97
|
+
* `value`/`defaultValue`/`onValueChange`, and `documentType` selects the mask + validator.
|
|
98
|
+
*/
|
|
99
|
+
function DocumentField({ value, defaultValue = "", onValueChange, onBlur, invalid = false, errorMessage, label, placeholder, disabled = false, required = false, name = "document", documentType = "CPF", className, ...props }) {
|
|
100
|
+
const isControlled = value !== void 0;
|
|
101
|
+
const [internalValue, setInternalValue] = useState(() => maskDocumentValue(defaultValue, documentType));
|
|
102
|
+
const [checkInvalid, setCheckInvalid] = useState(false);
|
|
103
|
+
const currentValue = isControlled ? value : internalValue;
|
|
104
|
+
const displayValue = maskDocumentValue(currentValue, documentType);
|
|
105
|
+
const showInvalid = invalid || checkInvalid;
|
|
106
|
+
const numericOnly = isDigitOnly(DOCUMENTS[documentType].mask);
|
|
107
|
+
function handleChange(event) {
|
|
108
|
+
const masked = maskDocumentValue(event.target.value, documentType);
|
|
109
|
+
if (!isControlled) setInternalValue(masked);
|
|
110
|
+
if (checkInvalid) setCheckInvalid(false);
|
|
111
|
+
onValueChange?.(masked);
|
|
112
|
+
}
|
|
113
|
+
function handleBlur(event) {
|
|
114
|
+
setCheckInvalid(!isValidDocument(currentValue, documentType));
|
|
115
|
+
onBlur?.(event);
|
|
116
|
+
}
|
|
117
|
+
return /* @__PURE__ */ jsxs(Field.Root, {
|
|
118
|
+
...props,
|
|
119
|
+
className,
|
|
120
|
+
name,
|
|
121
|
+
invalid: showInvalid,
|
|
122
|
+
disabled,
|
|
123
|
+
"data-fs-document-field": "",
|
|
124
|
+
children: [
|
|
125
|
+
label ? /* @__PURE__ */ jsx(Field.Label, { children: label }) : null,
|
|
126
|
+
/* @__PURE__ */ jsx(Field.Control, {
|
|
127
|
+
name,
|
|
128
|
+
required,
|
|
129
|
+
placeholder,
|
|
130
|
+
disabled,
|
|
131
|
+
value: displayValue,
|
|
132
|
+
...numericOnly ? { inputMode: "numeric" } : {},
|
|
133
|
+
onChange: handleChange,
|
|
134
|
+
onBlur: handleBlur
|
|
135
|
+
}),
|
|
136
|
+
showInvalid && errorMessage ? /* @__PURE__ */ jsx(Field.Error, {
|
|
137
|
+
match: true,
|
|
138
|
+
children: errorMessage
|
|
139
|
+
}) : null
|
|
140
|
+
]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
export { DOCUMENTS, DocumentField, DocumentFieldDefinition, applyMask, isSupportedDocumentType, isValidDocument, maskDocumentValue, validateCPF };
|
|
145
|
+
|
|
146
|
+
//# sourceMappingURL=document-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-field.js","names":[],"sources":["../../../src/particles/document-field/document-field.tsx"],"sourcesContent":["'use client';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ChangeEvent, ComponentPropsWithRef, FocusEvent } from 'react';\nimport { useState } from 'react';\nimport { Field } from '../field/field.js';\nimport { applyMask, countSlots, isDigitOnly } from '../shared/input-mask.js';\n\n// `applyMask` was public from this module before the engine moved out; keep the export path stable.\nexport { applyMask } from '../shared/input-mask.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type DocumentType = 'CPF';\n\nexport type DocumentSpec = {\n id: DocumentType;\n name: string;\n mask: string;\n validate: (value: string) => boolean;\n};\n\nexport type DocumentFieldProps = Omit<\n ComponentPropsWithRef<'div'>,\n 'defaultValue' | 'value' | 'onChange' | 'onBlur'\n> & {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n invalid?: boolean;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n disabled?: boolean;\n required?: boolean;\n name?: string;\n documentType?: DocumentType;\n};\n\n// ---------------------------------------------------------------------------\n// Ported check-digit validation (fastcheckout `packages/libs/validators/src/document`).\n// ---------------------------------------------------------------------------\n\n/**\n * CPF check-digit validation, ported from the legacy `validateCPF`. Strips non-digits, requires\n * exactly 11 digits, rejects all-equal sequences (e.g. `111.111.111-11`), and verifies both check\n * digits. Runs on blur/submit only, never per keystroke.\n */\nexport function validateCPF(value: string): boolean {\n const digits = value.replace(/[^\\d]+/g, '');\n\n if (digits.length !== 11 || /(\\d)\\1{10}/.test(digits)) {\n return false;\n }\n\n const values = digits.split('').map((el) => +el);\n const rest = (count: number) =>\n ((values.slice(0, count - 12).reduce((sum, el, index) => sum + el * (count - index), 0) * 10) % 11) % 10;\n\n return rest(10) === values[9] && rest(11) === values[10];\n}\n\n// ---------------------------------------------------------------------------\n// Document table (subset needed for the CPF launch). `documentType` selects the mask +\n// validator + digit-only input mode. Extendable later (SSN | SIN | CURP) without touching callers.\n// ---------------------------------------------------------------------------\n\nexport const DOCUMENTS: Record<DocumentType, DocumentSpec> = {\n CPF: {\n id: 'CPF',\n name: 'CPF',\n mask: '999.999.999-99',\n validate: validateCPF,\n },\n};\n\n/** True when `type` is a document type this build supports (lets a host gate the field by locale). */\nexport function isSupportedDocumentType(type: unknown): type is DocumentType {\n return typeof type === 'string' && type in DOCUMENTS;\n}\n\n/**\n * Apply a document type's mask to raw input: strip non-digits for digit-only masks, then truncate to\n * the mask's slot count so excess characters never trail past the mask (e.g. a 15-digit paste into\n * the 11-slot CPF mask yields `111.444.777-35`, not `111.444.777-358888`).\n */\nexport function maskDocumentValue(rawValue: string, documentType: DocumentType): string {\n const spec = DOCUMENTS[documentType];\n const sanitized = isDigitOnly(spec.mask) ? rawValue.replace(/\\D/g, '') : rawValue;\n const maxSlots = Math.max(...spec.mask.split('|').map(countSlots));\n return applyMask(sanitized.slice(0, maxSlots), spec.mask);\n}\n\n/**\n * Check-digit validity for a document value. An **empty** value is valid (the field is optional),\n * mirroring the legacy `validateCardholderDocument`; a non-empty value must pass the document\n * type's check-digit validation.\n */\nexport function isValidDocument(value: string, documentType: DocumentType): boolean {\n if (!value.trim()) return true;\n return DOCUMENTS[documentType].validate(value);\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nexport const DocumentFieldDefinition = defineComponent<DocumentFieldProps>({\n name: 'DocumentField',\n importPath: '@vtex/faststore/components',\n component: DocumentField,\n editor: { label: 'Document Field', category: 'content' },\n schema: {\n label: { type: 'string', label: 'Label' },\n placeholder: { type: 'string', label: 'Placeholder' },\n errorMessage: { type: 'string', label: 'Error message' },\n documentType: { type: 'string', default: 'CPF', label: 'Document type' },\n required: { type: 'boolean', default: false, label: 'Required' },\n disabled: { type: 'boolean', default: false, label: 'Disabled' },\n },\n guideline:\n 'Presentational tax-document input composing the Field particle; applies the locale mask on change and runs check-digit validation on blur/submit. Data-agnostic (value/defaultValue/onValueChange); a host wires it to the shopper profile. CPF is optional by default.',\n});\n\n/**\n * Presentational tax-document input (particle). Composes the `Field` particle (`Field.Root` +\n * `Field.Label` + `Field.Control` + `Field.Error`) and owns the locale mask (applied progressively on\n * every change, never blocking typing) plus check-digit validation (run on blur/submit only — never\n * per keystroke). An empty value is valid (the field is optional). It surfaces `errorMessage` inline\n * when the check digit fails or when the host forces `invalid` (e.g. a server error surfaced by the\n * form that owns the write). It consumes no GraphQL and no domain context — value flows through\n * `value`/`defaultValue`/`onValueChange`, and `documentType` selects the mask + validator.\n */\nexport function DocumentField({\n value,\n defaultValue = '',\n onValueChange,\n onBlur,\n invalid = false,\n errorMessage,\n label,\n placeholder,\n disabled = false,\n required = false,\n name = 'document',\n documentType = 'CPF',\n className,\n ...props\n}: DocumentFieldProps) {\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState(() => maskDocumentValue(defaultValue, documentType));\n const [checkInvalid, setCheckInvalid] = useState(false);\n\n const currentValue = isControlled ? value : internalValue;\n // Masking is idempotent, so masking here formats both a raw pre-fill (a controlled `value` seeded\n // from the saved profile) and an already-masked typed value identically.\n const displayValue = maskDocumentValue(currentValue, documentType);\n const showInvalid = invalid || checkInvalid;\n const numericOnly = isDigitOnly(DOCUMENTS[documentType].mask);\n\n function handleChange(event: ChangeEvent<HTMLInputElement>) {\n const masked = maskDocumentValue(event.target.value, documentType);\n if (!isControlled) setInternalValue(masked);\n // Clear a prior check-digit error while typing; it is re-evaluated on the next blur.\n if (checkInvalid) setCheckInvalid(false);\n onValueChange?.(masked);\n }\n\n function handleBlur(event: FocusEvent<HTMLInputElement>) {\n // Validation runs only after the complete number is entered; empty is valid (optional field).\n setCheckInvalid(!isValidDocument(currentValue, documentType));\n onBlur?.(event);\n }\n\n return (\n <Field.Root\n {...props}\n className={className}\n name={name}\n invalid={showInvalid}\n disabled={disabled}\n data-fs-document-field=\"\"\n >\n {label ? <Field.Label>{label}</Field.Label> : null}\n <Field.Control\n name={name}\n required={required}\n placeholder={placeholder}\n disabled={disabled}\n value={displayValue}\n {...(numericOnly ? { inputMode: 'numeric' as const } : {})}\n onChange={handleChange}\n onBlur={handleBlur}\n />\n {showInvalid && errorMessage ? <Field.Error match>{errorMessage}</Field.Error> : null}\n </Field.Root>\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/particles/drawer/drawer.d.ts
|
|
5
|
+
export type DrawerSwipeDirection = 'up' | 'down' | 'left' | 'right';
|
|
6
|
+
export type DrawerRootProps = {
|
|
7
|
+
swipeDirection?: DrawerSwipeDirection;
|
|
8
|
+
modal?: boolean;
|
|
9
|
+
open?: boolean;
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
onOpenChange?: (open: boolean, eventDetails: {
|
|
12
|
+
isCanceled: boolean;
|
|
13
|
+
}) => void;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
};
|
|
16
|
+
export type DrawerTriggerProps = ComponentPropsWithRef<'button'>;
|
|
17
|
+
export type DrawerPortalProps = {
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
export type DrawerBackdropProps = ComponentPropsWithRef<'div'>;
|
|
21
|
+
export type DrawerPopupProps = ComponentPropsWithRef<'div'>;
|
|
22
|
+
export type DrawerTitleProps = ComponentPropsWithRef<'h2'>;
|
|
23
|
+
export type DrawerDescriptionProps = ComponentPropsWithRef<'p'>;
|
|
24
|
+
export type DrawerCloseProps = ComponentPropsWithRef<'button'>;
|
|
25
|
+
export declare const DrawerRootDefinition: ComponentDefinition<DrawerRootProps>;
|
|
26
|
+
export declare const DrawerTriggerDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
|
|
27
|
+
export declare const DrawerPortalDefinition: ComponentDefinition<DrawerPortalProps>;
|
|
28
|
+
export declare const DrawerBackdropDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
29
|
+
export declare const DrawerPopupDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
30
|
+
export declare const DrawerTitleDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
31
|
+
export declare const DrawerDescriptionDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>>;
|
|
32
|
+
export declare const DrawerCloseDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
|
|
33
|
+
export declare function DrawerRoot({ swipeDirection, modal, children, ...props }: DrawerRootProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function DrawerTrigger({ className, children, ...props }: DrawerTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare function DrawerPortal({ children }: DrawerPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare function DrawerBackdrop({ className, children, ...props }: DrawerBackdropProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare function DrawerPopup({ className, children, ...props }: DrawerPopupProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function DrawerTitle({ className, children, ...props }: DrawerTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare function DrawerDescription({ className, children, ...props }: DrawerDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare function DrawerClose({ className, children, ...props }: DrawerCloseProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare const Drawer: {
|
|
42
|
+
Root: typeof DrawerRoot;
|
|
43
|
+
Trigger: typeof DrawerTrigger;
|
|
44
|
+
Portal: typeof DrawerPortal;
|
|
45
|
+
Backdrop: typeof DrawerBackdrop;
|
|
46
|
+
Popup: typeof DrawerPopup;
|
|
47
|
+
Title: typeof DrawerTitle;
|
|
48
|
+
Description: typeof DrawerDescription;
|
|
49
|
+
Close: typeof DrawerClose;
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Drawer } from "@base-ui/react/drawer";
|
|
6
|
+
//#region src/particles/drawer/drawer.tsx
|
|
7
|
+
const DrawerRootDefinition = defineComponent({
|
|
8
|
+
name: "DrawerRoot",
|
|
9
|
+
importPath: "@vtex/faststore/components",
|
|
10
|
+
component: DrawerRoot,
|
|
11
|
+
editor: {
|
|
12
|
+
label: "Drawer Root",
|
|
13
|
+
category: "layout"
|
|
14
|
+
},
|
|
15
|
+
schema: {
|
|
16
|
+
swipeDirection: {
|
|
17
|
+
type: [
|
|
18
|
+
"up",
|
|
19
|
+
"down",
|
|
20
|
+
"left",
|
|
21
|
+
"right"
|
|
22
|
+
],
|
|
23
|
+
default: "right",
|
|
24
|
+
label: "Swipe Direction"
|
|
25
|
+
},
|
|
26
|
+
modal: {
|
|
27
|
+
type: "boolean",
|
|
28
|
+
default: true,
|
|
29
|
+
label: "Modal"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
guideline: "Root of a drawer side panel. When modal (the default) it delivers the full overlay contract: focus trapping inside the popup, body scroll lock on the page behind it, Escape-to-close, and backdrop-click dismissal — all inherited from Base UI, none re-implemented in the layout. Compose as: DrawerRoot > (DrawerTrigger + DrawerPortal > (DrawerBackdrop + DrawerPopup > (DrawerTitle + DrawerDescription + content + DrawerClose))). Set swipeDirection to control the slide edge (right for cart/filters, bottom for mobile menus); modal=false only when the drawer must coexist with page interactions (drops focus trap and scroll lock)."
|
|
33
|
+
});
|
|
34
|
+
const DrawerTriggerDefinition = defineComponent({
|
|
35
|
+
name: "DrawerTrigger",
|
|
36
|
+
importPath: "@vtex/faststore/components",
|
|
37
|
+
component: DrawerTrigger,
|
|
38
|
+
editor: {
|
|
39
|
+
label: "Drawer Trigger",
|
|
40
|
+
category: "action"
|
|
41
|
+
},
|
|
42
|
+
schema: {},
|
|
43
|
+
guideline: "Button that opens the Drawer. Place inside or outside Drawer.Root — Base UI connects them via context."
|
|
44
|
+
});
|
|
45
|
+
const DrawerPortalDefinition = defineComponent({
|
|
46
|
+
name: "DrawerPortal",
|
|
47
|
+
importPath: "@vtex/faststore/components",
|
|
48
|
+
component: DrawerPortal,
|
|
49
|
+
editor: {
|
|
50
|
+
label: "Drawer Portal",
|
|
51
|
+
category: "layout"
|
|
52
|
+
},
|
|
53
|
+
schema: {},
|
|
54
|
+
guideline: "Portal wrapper that renders Drawer.Backdrop and Drawer.Popup outside the DOM tree. Always wrap both inside Drawer.Portal."
|
|
55
|
+
});
|
|
56
|
+
const DrawerBackdropDefinition = defineComponent({
|
|
57
|
+
name: "DrawerBackdrop",
|
|
58
|
+
importPath: "@vtex/faststore/components",
|
|
59
|
+
component: DrawerBackdrop,
|
|
60
|
+
editor: {
|
|
61
|
+
label: "Drawer Backdrop",
|
|
62
|
+
category: "layout"
|
|
63
|
+
},
|
|
64
|
+
schema: {},
|
|
65
|
+
guideline: "Semi-transparent overlay rendered behind the popup. Clicking it dismisses the drawer unless disablePointerDismissal is set on Drawer.Root."
|
|
66
|
+
});
|
|
67
|
+
const DrawerPopupDefinition = defineComponent({
|
|
68
|
+
name: "DrawerPopup",
|
|
69
|
+
importPath: "@vtex/faststore/components",
|
|
70
|
+
component: DrawerPopup,
|
|
71
|
+
editor: {
|
|
72
|
+
label: "Drawer Popup",
|
|
73
|
+
category: "layout"
|
|
74
|
+
},
|
|
75
|
+
schema: {},
|
|
76
|
+
guideline: "Main drawer panel. Animation and positioning are controlled by swipeDirection on Drawer.Root. Contains Drawer.Title, content, and Drawer.Close."
|
|
77
|
+
});
|
|
78
|
+
const DrawerTitleDefinition = defineComponent({
|
|
79
|
+
name: "DrawerTitle",
|
|
80
|
+
importPath: "@vtex/faststore/components",
|
|
81
|
+
component: DrawerTitle,
|
|
82
|
+
editor: {
|
|
83
|
+
label: "Drawer Title",
|
|
84
|
+
category: "layout"
|
|
85
|
+
},
|
|
86
|
+
schema: {},
|
|
87
|
+
guideline: "Semantic heading inside Drawer.Popup. Required for screen reader accessibility — sets the accessible name of the dialog."
|
|
88
|
+
});
|
|
89
|
+
const DrawerDescriptionDefinition = defineComponent({
|
|
90
|
+
name: "DrawerDescription",
|
|
91
|
+
importPath: "@vtex/faststore/components",
|
|
92
|
+
component: DrawerDescription,
|
|
93
|
+
editor: {
|
|
94
|
+
label: "Drawer Description",
|
|
95
|
+
category: "layout"
|
|
96
|
+
},
|
|
97
|
+
schema: {},
|
|
98
|
+
guideline: "Accessible description of the drawer. Optional but recommended for screen readers."
|
|
99
|
+
});
|
|
100
|
+
const DrawerCloseDefinition = defineComponent({
|
|
101
|
+
name: "DrawerClose",
|
|
102
|
+
importPath: "@vtex/faststore/components",
|
|
103
|
+
component: DrawerClose,
|
|
104
|
+
editor: {
|
|
105
|
+
label: "Drawer Close",
|
|
106
|
+
category: "action"
|
|
107
|
+
},
|
|
108
|
+
schema: {},
|
|
109
|
+
guideline: "Button that closes the drawer. Place at the top of Drawer.Popup. Receives ARIA label management automatically from Base UI."
|
|
110
|
+
});
|
|
111
|
+
function DrawerRoot({ swipeDirection = "right", modal = true, children, ...props }) {
|
|
112
|
+
return /* @__PURE__ */ jsx(Drawer.Root, {
|
|
113
|
+
...props,
|
|
114
|
+
swipeDirection,
|
|
115
|
+
modal,
|
|
116
|
+
children
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function DrawerTrigger({ className, children, ...props }) {
|
|
120
|
+
return /* @__PURE__ */ jsx(Drawer.Trigger, {
|
|
121
|
+
...props,
|
|
122
|
+
className,
|
|
123
|
+
"data-fs-drawer-trigger": "",
|
|
124
|
+
children
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function DrawerPortal({ children }) {
|
|
128
|
+
return /* @__PURE__ */ jsx(Drawer.Portal, { children });
|
|
129
|
+
}
|
|
130
|
+
function DrawerBackdrop({ className, children, ...props }) {
|
|
131
|
+
return /* @__PURE__ */ jsx(Drawer.Backdrop, {
|
|
132
|
+
...props,
|
|
133
|
+
className,
|
|
134
|
+
"data-fs-drawer-backdrop": "",
|
|
135
|
+
children
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function DrawerPopup({ className, children, ...props }) {
|
|
139
|
+
return /* @__PURE__ */ jsx(Drawer.Popup, {
|
|
140
|
+
...props,
|
|
141
|
+
className,
|
|
142
|
+
"data-fs-drawer-popup": "",
|
|
143
|
+
children
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function DrawerTitle({ className, children, ...props }) {
|
|
147
|
+
return /* @__PURE__ */ jsx(Drawer.Title, {
|
|
148
|
+
...props,
|
|
149
|
+
className,
|
|
150
|
+
"data-fs-drawer-title": "",
|
|
151
|
+
children
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function DrawerDescription({ className, children, ...props }) {
|
|
155
|
+
return /* @__PURE__ */ jsx(Drawer.Description, {
|
|
156
|
+
...props,
|
|
157
|
+
className,
|
|
158
|
+
"data-fs-drawer-description": "",
|
|
159
|
+
children
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function DrawerClose({ className, children, ...props }) {
|
|
163
|
+
return /* @__PURE__ */ jsx(Drawer.Close, {
|
|
164
|
+
...props,
|
|
165
|
+
className,
|
|
166
|
+
"data-fs-drawer-close": "",
|
|
167
|
+
children
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
const Drawer$1 = {
|
|
171
|
+
Root: DrawerRoot,
|
|
172
|
+
Trigger: DrawerTrigger,
|
|
173
|
+
Portal: DrawerPortal,
|
|
174
|
+
Backdrop: DrawerBackdrop,
|
|
175
|
+
Popup: DrawerPopup,
|
|
176
|
+
Title: DrawerTitle,
|
|
177
|
+
Description: DrawerDescription,
|
|
178
|
+
Close: DrawerClose
|
|
179
|
+
};
|
|
180
|
+
//#endregion
|
|
181
|
+
export { Drawer$1 as Drawer, DrawerBackdrop, DrawerBackdropDefinition, DrawerClose, DrawerCloseDefinition, DrawerDescription, DrawerDescriptionDefinition, DrawerPopup, DrawerPopupDefinition, DrawerPortal, DrawerPortalDefinition, DrawerRoot, DrawerRootDefinition, DrawerTitle, DrawerTitleDefinition, DrawerTrigger, DrawerTriggerDefinition };
|
|
182
|
+
|
|
183
|
+
//# sourceMappingURL=drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.js","names":["BaseDrawer","Drawer"],"sources":["../../../src/particles/drawer/drawer.tsx"],"sourcesContent":["'use client';\nimport { Drawer as BaseDrawer } from '@base-ui/react/drawer';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\n\nexport type DrawerSwipeDirection = 'up' | 'down' | 'left' | 'right';\n\nexport type DrawerRootProps = {\n swipeDirection?: DrawerSwipeDirection;\n modal?: boolean;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean, eventDetails: { isCanceled: boolean }) => void;\n children?: ReactNode;\n};\n\nexport type DrawerTriggerProps = ComponentPropsWithRef<'button'>;\n\nexport type DrawerPortalProps = {\n children?: ReactNode;\n};\n\nexport type DrawerBackdropProps = ComponentPropsWithRef<'div'>;\n\nexport type DrawerPopupProps = ComponentPropsWithRef<'div'>;\n\nexport type DrawerTitleProps = ComponentPropsWithRef<'h2'>;\n\nexport type DrawerDescriptionProps = ComponentPropsWithRef<'p'>;\n\nexport type DrawerCloseProps = ComponentPropsWithRef<'button'>;\n\nexport const DrawerRootDefinition = defineComponent<DrawerRootProps>({\n name: 'DrawerRoot',\n importPath: '@vtex/faststore/components',\n component: DrawerRoot,\n editor: { label: 'Drawer Root', category: 'layout' },\n schema: {\n swipeDirection: { type: ['up', 'down', 'left', 'right'] as const, default: 'right', label: 'Swipe Direction' },\n modal: { type: 'boolean', default: true, label: 'Modal' },\n },\n guideline:\n 'Root of a drawer side panel. When modal (the default) it delivers the full overlay contract: focus trapping inside the popup, body scroll lock on the page behind it, Escape-to-close, and backdrop-click dismissal — all inherited from Base UI, none re-implemented in the layout. Compose as: DrawerRoot > (DrawerTrigger + DrawerPortal > (DrawerBackdrop + DrawerPopup > (DrawerTitle + DrawerDescription + content + DrawerClose))). Set swipeDirection to control the slide edge (right for cart/filters, bottom for mobile menus); modal=false only when the drawer must coexist with page interactions (drops focus trap and scroll lock).',\n});\n\nexport const DrawerTriggerDefinition = defineComponent<DrawerTriggerProps>({\n name: 'DrawerTrigger',\n importPath: '@vtex/faststore/components',\n component: DrawerTrigger,\n editor: { label: 'Drawer Trigger', category: 'action' },\n schema: {},\n guideline: 'Button that opens the Drawer. Place inside or outside Drawer.Root — Base UI connects them via context.',\n});\n\nexport const DrawerPortalDefinition = defineComponent<DrawerPortalProps>({\n name: 'DrawerPortal',\n importPath: '@vtex/faststore/components',\n component: DrawerPortal,\n editor: { label: 'Drawer Portal', category: 'layout' },\n schema: {},\n guideline:\n 'Portal wrapper that renders Drawer.Backdrop and Drawer.Popup outside the DOM tree. Always wrap both inside Drawer.Portal.',\n});\n\nexport const DrawerBackdropDefinition = defineComponent<DrawerBackdropProps>({\n name: 'DrawerBackdrop',\n importPath: '@vtex/faststore/components',\n component: DrawerBackdrop,\n editor: { label: 'Drawer Backdrop', category: 'layout' },\n schema: {},\n guideline:\n 'Semi-transparent overlay rendered behind the popup. Clicking it dismisses the drawer unless disablePointerDismissal is set on Drawer.Root.',\n});\n\nexport const DrawerPopupDefinition = defineComponent<DrawerPopupProps>({\n name: 'DrawerPopup',\n importPath: '@vtex/faststore/components',\n component: DrawerPopup,\n editor: { label: 'Drawer Popup', category: 'layout' },\n schema: {},\n guideline:\n 'Main drawer panel. Animation and positioning are controlled by swipeDirection on Drawer.Root. Contains Drawer.Title, content, and Drawer.Close.',\n});\n\nexport const DrawerTitleDefinition = defineComponent<DrawerTitleProps>({\n name: 'DrawerTitle',\n importPath: '@vtex/faststore/components',\n component: DrawerTitle,\n editor: { label: 'Drawer Title', category: 'layout' },\n schema: {},\n guideline:\n 'Semantic heading inside Drawer.Popup. Required for screen reader accessibility — sets the accessible name of the dialog.',\n});\n\nexport const DrawerDescriptionDefinition = defineComponent<DrawerDescriptionProps>({\n name: 'DrawerDescription',\n importPath: '@vtex/faststore/components',\n component: DrawerDescription,\n editor: { label: 'Drawer Description', category: 'layout' },\n schema: {},\n guideline: 'Accessible description of the drawer. Optional but recommended for screen readers.',\n});\n\nexport const DrawerCloseDefinition = defineComponent<DrawerCloseProps>({\n name: 'DrawerClose',\n importPath: '@vtex/faststore/components',\n component: DrawerClose,\n editor: { label: 'Drawer Close', category: 'action' },\n schema: {},\n guideline:\n 'Button that closes the drawer. Place at the top of Drawer.Popup. Receives ARIA label management automatically from Base UI.',\n});\n\nexport function DrawerRoot({ swipeDirection = 'right', modal = true, children, ...props }: DrawerRootProps) {\n return (\n <BaseDrawer.Root {...props} swipeDirection={swipeDirection} modal={modal}>\n {children}\n </BaseDrawer.Root>\n );\n}\n\nexport function DrawerTrigger({ className, children, ...props }: DrawerTriggerProps) {\n return (\n <BaseDrawer.Trigger {...props} className={className} data-fs-drawer-trigger=\"\">\n {children}\n </BaseDrawer.Trigger>\n );\n}\n\nexport function DrawerPortal({ children }: DrawerPortalProps) {\n return <BaseDrawer.Portal>{children}</BaseDrawer.Portal>;\n}\n\nexport function DrawerBackdrop({ className, children, ...props }: DrawerBackdropProps) {\n return (\n <BaseDrawer.Backdrop {...props} className={className} data-fs-drawer-backdrop=\"\">\n {children}\n </BaseDrawer.Backdrop>\n );\n}\n\nexport function DrawerPopup({ className, children, ...props }: DrawerPopupProps) {\n return (\n <BaseDrawer.Popup {...props} className={className} data-fs-drawer-popup=\"\">\n {children}\n </BaseDrawer.Popup>\n );\n}\n\nexport function DrawerTitle({ className, children, ...props }: DrawerTitleProps) {\n return (\n <BaseDrawer.Title {...props} className={className} data-fs-drawer-title=\"\">\n {children}\n </BaseDrawer.Title>\n );\n}\n\nexport function DrawerDescription({ className, children, ...props }: DrawerDescriptionProps) {\n return (\n <BaseDrawer.Description {...props} className={className} data-fs-drawer-description=\"\">\n {children}\n </BaseDrawer.Description>\n );\n}\n\nexport function DrawerClose({ className, children, ...props }: DrawerCloseProps) {\n return (\n <BaseDrawer.Close {...props} className={className} data-fs-drawer-close=\"\">\n {children}\n </BaseDrawer.Close>\n );\n}\n\nexport const Drawer = {\n Root: DrawerRoot,\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Backdrop: DrawerBackdrop,\n Popup: DrawerPopup,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Close: DrawerClose,\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { ComponentPropsWithRef, FocusEvent } from "react";
|
|
4
|
+
//#region src/particles/email-field/email-field.d.ts
|
|
5
|
+
export type EmailFieldProps = Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'value' | 'onChange' | 'onBlur'> & {
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
onValueChange?: (value: string) => void;
|
|
9
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
10
|
+
invalid?: boolean;
|
|
11
|
+
errorMessage?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
name?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Email format rule, ported from the legacy `EMAIL_VALIDATE_REGEX` (fastcheckout `validations.ts`).
|
|
20
|
+
* The exact legacy source was unavailable at authoring time, so this uses the WHATWG/HTML5 email-input
|
|
21
|
+
* pattern — the same rule the browser applies to `<input type="email">`. Format validation runs on
|
|
22
|
+
* blur/submit only, never per keystroke (Invariants & Constraints).
|
|
23
|
+
*/
|
|
24
|
+
export declare const EMAIL_VALIDATE_REGEX: RegExp;
|
|
25
|
+
/** True when `value` is a well-formed email address. Trims surrounding whitespace before testing. */
|
|
26
|
+
export declare function isValidEmail(value: string): boolean;
|
|
27
|
+
export declare const EmailFieldDefinition: ComponentDefinition<EmailFieldProps>;
|
|
28
|
+
/**
|
|
29
|
+
* Presentational email input (particle). Composes the `Field` particle (`Field.Root` + `Field.Label` +
|
|
30
|
+
* `Field.Control` + `Field.Error`) and owns email **format** validation: it validates on blur/submit
|
|
31
|
+
* (never per keystroke) and surfaces `errorMessage` inline when the format is invalid or when the host
|
|
32
|
+
* forces `invalid` (e.g. a server-side error from `EmailIdentificationControl`). It consumes no
|
|
33
|
+
* GraphQL and no domain context — value flows through `value`/`defaultValue`/`onValueChange`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function EmailField({ value, defaultValue, onValueChange, onBlur, invalid, errorMessage, label, placeholder, disabled, required, name, className, ...props }: EmailFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
//#endregion
|
|
37
|
+
//# sourceMappingURL=email-field.d.ts.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { Field } from "../field/field.js";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/particles/email-field/email-field.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Email format rule, ported from the legacy `EMAIL_VALIDATE_REGEX` (fastcheckout `validations.ts`).
|
|
10
|
+
* The exact legacy source was unavailable at authoring time, so this uses the WHATWG/HTML5 email-input
|
|
11
|
+
* pattern — the same rule the browser applies to `<input type="email">`. Format validation runs on
|
|
12
|
+
* blur/submit only, never per keystroke (Invariants & Constraints).
|
|
13
|
+
*/
|
|
14
|
+
const EMAIL_VALIDATE_REGEX = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/;
|
|
15
|
+
/** True when `value` is a well-formed email address. Trims surrounding whitespace before testing. */
|
|
16
|
+
function isValidEmail(value) {
|
|
17
|
+
return EMAIL_VALIDATE_REGEX.test(value.trim());
|
|
18
|
+
}
|
|
19
|
+
const EmailFieldDefinition = defineComponent({
|
|
20
|
+
name: "EmailField",
|
|
21
|
+
importPath: "@vtex/faststore/components",
|
|
22
|
+
component: EmailField,
|
|
23
|
+
editor: {
|
|
24
|
+
label: "Email Field",
|
|
25
|
+
category: "content"
|
|
26
|
+
},
|
|
27
|
+
schema: {
|
|
28
|
+
label: {
|
|
29
|
+
type: "string",
|
|
30
|
+
label: "Label"
|
|
31
|
+
},
|
|
32
|
+
placeholder: {
|
|
33
|
+
type: "string",
|
|
34
|
+
label: "Placeholder"
|
|
35
|
+
},
|
|
36
|
+
errorMessage: {
|
|
37
|
+
type: "string",
|
|
38
|
+
label: "Error message"
|
|
39
|
+
},
|
|
40
|
+
required: {
|
|
41
|
+
type: "boolean",
|
|
42
|
+
default: true,
|
|
43
|
+
label: "Required"
|
|
44
|
+
},
|
|
45
|
+
disabled: {
|
|
46
|
+
type: "boolean",
|
|
47
|
+
default: false,
|
|
48
|
+
label: "Disabled"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
guideline: "Presentational, data-agnostic email input with blur/submit format validation; for a checkout-bound field use EmailIdentificationControl instead. See email-field.md."
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* Presentational email input (particle). Composes the `Field` particle (`Field.Root` + `Field.Label` +
|
|
55
|
+
* `Field.Control` + `Field.Error`) and owns email **format** validation: it validates on blur/submit
|
|
56
|
+
* (never per keystroke) and surfaces `errorMessage` inline when the format is invalid or when the host
|
|
57
|
+
* forces `invalid` (e.g. a server-side error from `EmailIdentificationControl`). It consumes no
|
|
58
|
+
* GraphQL and no domain context — value flows through `value`/`defaultValue`/`onValueChange`.
|
|
59
|
+
*/
|
|
60
|
+
function EmailField({ value, defaultValue = "", onValueChange, onBlur, invalid = false, errorMessage, label, placeholder, disabled = false, required = true, name = "email", className, ...props }) {
|
|
61
|
+
const isControlled = value !== void 0;
|
|
62
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
63
|
+
const [formatInvalid, setFormatInvalid] = useState(false);
|
|
64
|
+
const currentValue = isControlled ? value : internalValue;
|
|
65
|
+
const showInvalid = invalid || formatInvalid;
|
|
66
|
+
function handleChange(event) {
|
|
67
|
+
const next = event.target.value;
|
|
68
|
+
if (!isControlled) setInternalValue(next);
|
|
69
|
+
if (formatInvalid) setFormatInvalid(false);
|
|
70
|
+
onValueChange?.(next);
|
|
71
|
+
}
|
|
72
|
+
function handleBlur(event) {
|
|
73
|
+
const trimmed = currentValue.trim();
|
|
74
|
+
setFormatInvalid(trimmed.length > 0 && !isValidEmail(trimmed));
|
|
75
|
+
onBlur?.(event);
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ jsxs(Field.Root, {
|
|
78
|
+
...props,
|
|
79
|
+
className,
|
|
80
|
+
name,
|
|
81
|
+
invalid: showInvalid,
|
|
82
|
+
disabled,
|
|
83
|
+
"data-fs-email-field": "",
|
|
84
|
+
children: [
|
|
85
|
+
label ? /* @__PURE__ */ jsx(Field.Label, { children: label }) : null,
|
|
86
|
+
/* @__PURE__ */ jsx(Field.Control, {
|
|
87
|
+
type: "email",
|
|
88
|
+
name,
|
|
89
|
+
required,
|
|
90
|
+
placeholder,
|
|
91
|
+
disabled,
|
|
92
|
+
onChange: handleChange,
|
|
93
|
+
onBlur: handleBlur,
|
|
94
|
+
...isControlled ? { value: currentValue } : { defaultValue }
|
|
95
|
+
}),
|
|
96
|
+
showInvalid && errorMessage ? /* @__PURE__ */ jsx(Field.Error, {
|
|
97
|
+
match: true,
|
|
98
|
+
children: errorMessage
|
|
99
|
+
}) : null
|
|
100
|
+
]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { EMAIL_VALIDATE_REGEX, EmailField, EmailFieldDefinition, isValidEmail };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=email-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-field.js","names":[],"sources":["../../../src/particles/email-field/email-field.tsx"],"sourcesContent":["'use client';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ChangeEvent, ComponentPropsWithRef, FocusEvent } from 'react';\nimport { useState } from 'react';\nimport { Field } from '../field/field.js';\n\nexport type EmailFieldProps = Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'value' | 'onChange' | 'onBlur'> & {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n invalid?: boolean;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n disabled?: boolean;\n required?: boolean;\n name?: string;\n};\n\n/**\n * Email format rule, ported from the legacy `EMAIL_VALIDATE_REGEX` (fastcheckout `validations.ts`).\n * The exact legacy source was unavailable at authoring time, so this uses the WHATWG/HTML5 email-input\n * pattern — the same rule the browser applies to `<input type=\"email\">`. Format validation runs on\n * blur/submit only, never per keystroke (Invariants & Constraints).\n */\nexport const EMAIL_VALIDATE_REGEX =\n /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/;\n\n/** True when `value` is a well-formed email address. Trims surrounding whitespace before testing. */\nexport function isValidEmail(value: string): boolean {\n return EMAIL_VALIDATE_REGEX.test(value.trim());\n}\n\nexport const EmailFieldDefinition = defineComponent<EmailFieldProps>({\n name: 'EmailField',\n importPath: '@vtex/faststore/components',\n component: EmailField,\n editor: { label: 'Email Field', category: 'content' },\n schema: {\n label: { type: 'string', label: 'Label' },\n placeholder: { type: 'string', label: 'Placeholder' },\n errorMessage: { type: 'string', label: 'Error message' },\n required: { type: 'boolean', default: true, label: 'Required' },\n disabled: { type: 'boolean', default: false, label: 'Disabled' },\n },\n guideline:\n 'Presentational, data-agnostic email input with blur/submit format validation; for a checkout-bound field use EmailIdentificationControl instead. See email-field.md.',\n});\n\n/**\n * Presentational email input (particle). Composes the `Field` particle (`Field.Root` + `Field.Label` +\n * `Field.Control` + `Field.Error`) and owns email **format** validation: it validates on blur/submit\n * (never per keystroke) and surfaces `errorMessage` inline when the format is invalid or when the host\n * forces `invalid` (e.g. a server-side error from `EmailIdentificationControl`). It consumes no\n * GraphQL and no domain context — value flows through `value`/`defaultValue`/`onValueChange`.\n */\nexport function EmailField({\n value,\n defaultValue = '',\n onValueChange,\n onBlur,\n invalid = false,\n errorMessage,\n label,\n placeholder,\n disabled = false,\n required = true,\n name = 'email',\n className,\n ...props\n}: EmailFieldProps) {\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState(defaultValue);\n const [formatInvalid, setFormatInvalid] = useState(false);\n\n const currentValue = isControlled ? value : internalValue;\n const showInvalid = invalid || formatInvalid;\n\n function handleChange(event: ChangeEvent<HTMLInputElement>) {\n const next = event.target.value;\n if (!isControlled) setInternalValue(next);\n // Clear a prior format error while typing; it is re-evaluated on the next blur (no per-keystroke validation).\n if (formatInvalid) setFormatInvalid(false);\n onValueChange?.(next);\n }\n\n function handleBlur(event: FocusEvent<HTMLInputElement>) {\n const trimmed = currentValue.trim();\n setFormatInvalid(trimmed.length > 0 && !isValidEmail(trimmed));\n onBlur?.(event);\n }\n\n return (\n <Field.Root\n {...props}\n className={className}\n name={name}\n invalid={showInvalid}\n disabled={disabled}\n data-fs-email-field=\"\"\n >\n {label ? <Field.Label>{label}</Field.Label> : null}\n <Field.Control\n type=\"email\"\n name={name}\n required={required}\n placeholder={placeholder}\n disabled={disabled}\n onChange={handleChange}\n onBlur={handleBlur}\n {...(isControlled ? { value: currentValue } : { defaultValue })}\n />\n {showInvalid && errorMessage ? <Field.Error match>{errorMessage}</Field.Error> : null}\n </Field.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,MAAa,uBACX;;AAGF,SAAgB,aAAa,OAAwB;CACnD,OAAO,qBAAqB,KAAK,MAAM,KAAK,CAAC;AAC/C;AAEA,MAAa,uBAAuB,gBAAiC;CACnE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAe,UAAU;CAAU;CACpD,QAAQ;EACN,OAAO;GAAE,MAAM;GAAU,OAAO;EAAQ;EACxC,aAAa;GAAE,MAAM;GAAU,OAAO;EAAc;EACpD,cAAc;GAAE,MAAM;GAAU,OAAO;EAAgB;EACvD,UAAU;GAAE,MAAM;GAAW,SAAS;GAAM,OAAO;EAAW;EAC9D,UAAU;GAAE,MAAM;GAAW,SAAS;GAAO,OAAO;EAAW;CACjE;CACA,WACE;AACJ,CAAC;;;;;;;;AASD,SAAgB,WAAW,EACzB,OACA,eAAe,IACf,eACA,QACA,UAAU,OACV,cACA,OACA,aACA,WAAW,OACX,WAAW,MACX,OAAO,SACP,WACA,GAAG,SACe;CAClB,MAAM,eAAe,UAAU,KAAA;CAC/B,MAAM,CAAC,eAAe,oBAAoB,SAAS,YAAY;CAC/D,MAAM,CAAC,eAAe,oBAAoB,SAAS,KAAK;CAExD,MAAM,eAAe,eAAe,QAAQ;CAC5C,MAAM,cAAc,WAAW;CAE/B,SAAS,aAAa,OAAsC;EAC1D,MAAM,OAAO,MAAM,OAAO;EAC1B,IAAI,CAAC,cAAc,iBAAiB,IAAI;EAExC,IAAI,eAAe,iBAAiB,KAAK;EACzC,gBAAgB,IAAI;CACtB;CAEA,SAAS,WAAW,OAAqC;EACvD,MAAM,UAAU,aAAa,KAAK;EAClC,iBAAiB,QAAQ,SAAS,KAAK,CAAC,aAAa,OAAO,CAAC;EAC7D,SAAS,KAAK;CAChB;CAEA,OACE,qBAAC,MAAM,MAAP;EACE,GAAI;EACO;EACL;EACN,SAAS;EACC;EACV,uBAAoB;EANtB,UAAA;GAQG,QAAQ,oBAAC,MAAM,OAAP,EAAA,UAAc,MAAmB,CAAA,IAAI;GAC9C,oBAAC,MAAM,SAAP;IACE,MAAK;IACC;IACI;IACG;IACH;IACV,UAAU;IACV,QAAQ;IACR,GAAK,eAAe,EAAE,OAAO,aAAa,IAAI,EAAE,aAAa;GAC9D,CAAA;GACA,eAAe,eAAe,oBAAC,MAAM,OAAP;IAAa,OAAA;IAAO,UAAA;GAA0B,CAAA,IAAI;EACvE;;AAEhB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
import { FieldValidityState } from "@base-ui/react/field";
|
|
5
|
+
//#region src/particles/field/field.d.ts
|
|
6
|
+
export type FieldRootProps = ComponentPropsWithRef<'div'> & {
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
invalid?: boolean;
|
|
9
|
+
name?: string;
|
|
10
|
+
};
|
|
11
|
+
export type FieldLabelProps = ComponentPropsWithRef<'label'>;
|
|
12
|
+
export type FieldControlProps = Omit<ComponentPropsWithRef<'input'>, 'children'>;
|
|
13
|
+
export type FieldDescriptionProps = ComponentPropsWithRef<'p'>;
|
|
14
|
+
export type FieldErrorProps = ComponentPropsWithRef<'div'> & {
|
|
15
|
+
/**
|
|
16
|
+
* Controls when the error is shown. `true` always shows it (for externally/caller-driven
|
|
17
|
+
* validity, e.g. presence-only checks with no native constraint validation); a
|
|
18
|
+
* `ValidityState` key shows it only when that specific native validity flag is set. Omit to
|
|
19
|
+
* fall back to Base UI's default: shown whenever the field's tracked validity is invalid.
|
|
20
|
+
* Note `match={false}` does not suppress the error — it falls back to that default
|
|
21
|
+
* invalid-driven behavior; callers needing a boolean should use `invalid ? true : 'customError'`.
|
|
22
|
+
*/
|
|
23
|
+
match?: boolean | keyof ValidityState;
|
|
24
|
+
};
|
|
25
|
+
export type FieldValidityProps = {
|
|
26
|
+
children: (state: FieldValidityState) => ReactNode;
|
|
27
|
+
};
|
|
28
|
+
export declare const FieldRootDefinition: ComponentDefinition<FieldRootProps>;
|
|
29
|
+
export declare const FieldLabelDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>>;
|
|
30
|
+
export declare const FieldControlDefinition: ComponentDefinition<FieldControlProps>;
|
|
31
|
+
export declare const FieldDescriptionDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>>;
|
|
32
|
+
export declare const FieldErrorDefinition: ComponentDefinition<FieldErrorProps>;
|
|
33
|
+
export declare const FieldValidityDefinition: ComponentDefinition<FieldValidityProps>;
|
|
34
|
+
export declare function FieldRoot({ disabled, invalid, name, className, children, ...props }: FieldRootProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare function FieldLabel({ className, children, ...props }: FieldLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare function FieldControl({ className, ...props }: FieldControlProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare function FieldDescription({ className, children, ...props }: FieldDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function FieldError({ className, children, ...props }: FieldErrorProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare function FieldValidity({ children }: FieldValidityProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
declare const Field$1: {
|
|
41
|
+
Root: typeof FieldRoot;
|
|
42
|
+
Label: typeof FieldLabel;
|
|
43
|
+
Control: typeof FieldControl;
|
|
44
|
+
Description: typeof FieldDescription;
|
|
45
|
+
Error: typeof FieldError;
|
|
46
|
+
Validity: typeof FieldValidity;
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { Field$1 as Field };
|
|
50
|
+
//# sourceMappingURL=field.d.ts.map
|