@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,355 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { graphql } from "../../sdk/generated/gql.js";
|
|
5
|
+
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
6
|
+
import { createContext, useContext, useEffect, useId, useRef, useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Collapsible } from "@base-ui/react/collapsible";
|
|
9
|
+
//#region src/matter/product-information/product-information.tsx
|
|
10
|
+
const fragment = graphql(`
|
|
11
|
+
fragment ProductInformationData on Query {
|
|
12
|
+
productBySlug(slug: $slug) {
|
|
13
|
+
__typename
|
|
14
|
+
id
|
|
15
|
+
title
|
|
16
|
+
description
|
|
17
|
+
descriptionHtml
|
|
18
|
+
referenceId
|
|
19
|
+
vendor
|
|
20
|
+
brand {
|
|
21
|
+
__typename
|
|
22
|
+
id
|
|
23
|
+
name
|
|
24
|
+
}
|
|
25
|
+
variants(first: 1) {
|
|
26
|
+
edges {
|
|
27
|
+
node {
|
|
28
|
+
__typename
|
|
29
|
+
id
|
|
30
|
+
sku
|
|
31
|
+
name
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
seo {
|
|
36
|
+
title
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`);
|
|
41
|
+
const PRODUCT_INFORMATION_CONTEXT_UNSET = Symbol("ProductInformationContextUnset");
|
|
42
|
+
const ProductInformationContext = createContext(PRODUCT_INFORMATION_CONTEXT_UNSET);
|
|
43
|
+
function useProductInformation() {
|
|
44
|
+
const ctx = useContext(ProductInformationContext);
|
|
45
|
+
if (ctx === PRODUCT_INFORMATION_CONTEXT_UNSET) throw new Error("ProductInformation components must be used inside ProductInformationRoot.");
|
|
46
|
+
return ctx;
|
|
47
|
+
}
|
|
48
|
+
function transformProductInformationData(data) {
|
|
49
|
+
const brand = data.brand?.name ?? data.vendor ?? null;
|
|
50
|
+
const firstVariant = data.variants.edges[0]?.node ?? null;
|
|
51
|
+
const sku = firstVariant?.sku ?? null;
|
|
52
|
+
const variantName = firstVariant?.name ?? null;
|
|
53
|
+
const seoTitle = data.seo?.title ?? null;
|
|
54
|
+
return {
|
|
55
|
+
title: data.title,
|
|
56
|
+
description: data.description,
|
|
57
|
+
descriptionHtml: data.descriptionHtml,
|
|
58
|
+
referenceId: data.referenceId,
|
|
59
|
+
brand,
|
|
60
|
+
sku,
|
|
61
|
+
variantName,
|
|
62
|
+
seoTitle
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const ProductInformationRootDefinition = defineComponent({
|
|
66
|
+
name: "ProductInformationRoot",
|
|
67
|
+
importPath: "@vtex/faststore/components",
|
|
68
|
+
component: ProductInformationRoot,
|
|
69
|
+
fragment,
|
|
70
|
+
fetchStrategy: "reactive",
|
|
71
|
+
editor: {
|
|
72
|
+
label: "Product Information",
|
|
73
|
+
category: "commerce"
|
|
74
|
+
},
|
|
75
|
+
schema: {},
|
|
76
|
+
providesContext: "product-information",
|
|
77
|
+
guideline: "Root container for PDP product text — wraps ProductInformationTitle, ProductInformationDescription, ProductInformationBrand, ProductInformationSku, and ProductInformationReferenceId (any subset, any order). See product-information.md."
|
|
78
|
+
});
|
|
79
|
+
const ProductInformationTitleDefinition = defineComponent({
|
|
80
|
+
name: "ProductInformationTitle",
|
|
81
|
+
importPath: "@vtex/faststore/components",
|
|
82
|
+
component: ProductInformationTitle,
|
|
83
|
+
editor: {
|
|
84
|
+
label: "Product Title",
|
|
85
|
+
category: "commerce"
|
|
86
|
+
},
|
|
87
|
+
schema: {
|
|
88
|
+
as: {
|
|
89
|
+
type: [
|
|
90
|
+
"h1",
|
|
91
|
+
"h2",
|
|
92
|
+
"h3",
|
|
93
|
+
"h4",
|
|
94
|
+
"h5",
|
|
95
|
+
"h6"
|
|
96
|
+
],
|
|
97
|
+
default: "h1",
|
|
98
|
+
label: "Element tag"
|
|
99
|
+
},
|
|
100
|
+
separator: {
|
|
101
|
+
type: "string",
|
|
102
|
+
label: "Variant separator"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
requiresContext: "product-information",
|
|
106
|
+
guideline: "Renders the product title inside a ProductInformationRoot (or any ancestor providing `product-information` context); `as` controls the heading level (`h1`–`h6`, default `h1`) and `separator` optionally appends the selected variant name."
|
|
107
|
+
});
|
|
108
|
+
const ProductInformationDescriptionDefinition = defineComponent({
|
|
109
|
+
name: "ProductInformationDescription",
|
|
110
|
+
importPath: "@vtex/faststore/components",
|
|
111
|
+
component: ProductInformationDescription,
|
|
112
|
+
editor: {
|
|
113
|
+
label: "Product Description",
|
|
114
|
+
category: "commerce"
|
|
115
|
+
},
|
|
116
|
+
schema: {
|
|
117
|
+
format: {
|
|
118
|
+
type: [
|
|
119
|
+
"auto",
|
|
120
|
+
"plain",
|
|
121
|
+
"html"
|
|
122
|
+
],
|
|
123
|
+
default: "auto",
|
|
124
|
+
label: "Description format"
|
|
125
|
+
},
|
|
126
|
+
collapse: {
|
|
127
|
+
type: [
|
|
128
|
+
"none",
|
|
129
|
+
"showMore",
|
|
130
|
+
"section"
|
|
131
|
+
],
|
|
132
|
+
default: "none",
|
|
133
|
+
label: "Collapse pattern"
|
|
134
|
+
},
|
|
135
|
+
defaultExpanded: {
|
|
136
|
+
type: "boolean",
|
|
137
|
+
default: true,
|
|
138
|
+
label: "Expanded by default"
|
|
139
|
+
},
|
|
140
|
+
collapsedLines: {
|
|
141
|
+
type: "number",
|
|
142
|
+
default: 4,
|
|
143
|
+
label: "Collapsed line count"
|
|
144
|
+
},
|
|
145
|
+
moreLabel: {
|
|
146
|
+
type: "string",
|
|
147
|
+
default: "Show more",
|
|
148
|
+
label: "Trigger label (collapsed)"
|
|
149
|
+
},
|
|
150
|
+
lessLabel: {
|
|
151
|
+
type: "string",
|
|
152
|
+
default: "Show less",
|
|
153
|
+
label: "Trigger label (expanded)"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
requiresContext: "product-information",
|
|
157
|
+
guideline: "Renders the product description inside a ProductInformationRoot (or any ancestor providing `product-information` context); `format` selects the source (`'auto'` default prefers HTML, `'plain'` forces plain text, `'html'` forces HTML only); `collapse` selects the reveal pattern (`'none'` default, `'showMore'` inline line-clamp via `collapsedLines` with `moreLabel`/`lessLabel`, `'section'` Base UI Collapsible disclosure)."
|
|
158
|
+
});
|
|
159
|
+
const ProductInformationBrandDefinition = defineComponent({
|
|
160
|
+
name: "ProductInformationBrand",
|
|
161
|
+
importPath: "@vtex/faststore/components",
|
|
162
|
+
component: ProductInformationBrand,
|
|
163
|
+
editor: {
|
|
164
|
+
label: "Product Brand",
|
|
165
|
+
category: "commerce"
|
|
166
|
+
},
|
|
167
|
+
schema: {},
|
|
168
|
+
requiresContext: "product-information",
|
|
169
|
+
guideline: "Renders the product brand name inside a ProductInformationRoot (or any ancestor providing `product-information` context); prefers `brand.name` and falls back to `vendor`."
|
|
170
|
+
});
|
|
171
|
+
const ProductInformationSkuDefinition = defineComponent({
|
|
172
|
+
name: "ProductInformationSku",
|
|
173
|
+
importPath: "@vtex/faststore/components",
|
|
174
|
+
component: ProductInformationSku,
|
|
175
|
+
editor: {
|
|
176
|
+
label: "Product SKU",
|
|
177
|
+
category: "commerce"
|
|
178
|
+
},
|
|
179
|
+
schema: {},
|
|
180
|
+
requiresContext: "product-information",
|
|
181
|
+
guideline: "Renders the first-variant SKU code inside a ProductInformationRoot (or any ancestor providing `product-information` context)."
|
|
182
|
+
});
|
|
183
|
+
const ProductInformationReferenceIdDefinition = defineComponent({
|
|
184
|
+
name: "ProductInformationReferenceId",
|
|
185
|
+
importPath: "@vtex/faststore/components",
|
|
186
|
+
component: ProductInformationReferenceId,
|
|
187
|
+
editor: {
|
|
188
|
+
label: "Product Reference ID",
|
|
189
|
+
category: "commerce"
|
|
190
|
+
},
|
|
191
|
+
schema: {},
|
|
192
|
+
requiresContext: "product-information",
|
|
193
|
+
guideline: "Renders the merchant reference ID inside a ProductInformationRoot (or any ancestor providing `product-information` context)."
|
|
194
|
+
});
|
|
195
|
+
function ProductInformationRoot({ $data: $dataProp, className, children, ...props }) {
|
|
196
|
+
const $data = useDataOverride($dataProp);
|
|
197
|
+
const contextValue = $data ? transformProductInformationData($data) : null;
|
|
198
|
+
return /* @__PURE__ */ jsx(ProductInformationContext, {
|
|
199
|
+
value: contextValue,
|
|
200
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
201
|
+
...props,
|
|
202
|
+
className,
|
|
203
|
+
"data-fs-product-information": "",
|
|
204
|
+
children
|
|
205
|
+
})
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function ProductInformationTitle({ as = "h1", separator, className, ...props }) {
|
|
209
|
+
const ctx = useProductInformation();
|
|
210
|
+
const variantName = ctx?.variantName ?? null;
|
|
211
|
+
const warnedRef = useRef(false);
|
|
212
|
+
const nullVariantSeenRef = useRef(false);
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
if (process.env.NODE_ENV !== "production") return;
|
|
215
|
+
if (separator === void 0 || !ctx) return;
|
|
216
|
+
if (variantName === null) {
|
|
217
|
+
if (nullVariantSeenRef.current && !warnedRef.current) {
|
|
218
|
+
warnedRef.current = true;
|
|
219
|
+
console.warn("[ProductInformationTitle] `separator` is set but the selected variant has no `name`; the title will render the product name alone. Ensure the SKU Selector wires Variant.name into the cache, or omit `separator` to silence this warning.");
|
|
220
|
+
}
|
|
221
|
+
nullVariantSeenRef.current = true;
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
nullVariantSeenRef.current = false;
|
|
225
|
+
});
|
|
226
|
+
if (!ctx) return null;
|
|
227
|
+
const composed = separator !== void 0 && variantName ? `${ctx.title}${separator}${variantName}` : ctx.title;
|
|
228
|
+
return /* @__PURE__ */ jsx(as, {
|
|
229
|
+
...props,
|
|
230
|
+
className,
|
|
231
|
+
"data-fs-product-information-title": "",
|
|
232
|
+
"data-fs-product-information-title-as": as,
|
|
233
|
+
children: composed
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function ProductInformationDescription({ format = "auto", collapse = "none", defaultExpanded = true, collapsedLines = 4, moreLabel = "Show more", lessLabel = "Show less", className, ...props }) {
|
|
237
|
+
const ctx = useProductInformation();
|
|
238
|
+
if (!ctx) return null;
|
|
239
|
+
const wantsRich = format === "auto" || format === "html";
|
|
240
|
+
const wantsPlain = format === "auto" || format === "plain";
|
|
241
|
+
const htmlPayload = wantsRich ? ctx.descriptionHtml : null;
|
|
242
|
+
const plain = wantsPlain ? ctx.description : null;
|
|
243
|
+
if (!htmlPayload && !plain) return null;
|
|
244
|
+
const htmlProps = htmlPayload ? { dangerouslySetInnerHTML: { __html: htmlPayload } } : void 0;
|
|
245
|
+
const panelChildren = htmlPayload ? void 0 : plain;
|
|
246
|
+
if (collapse === "none") {
|
|
247
|
+
if (htmlPayload) return /* @__PURE__ */ jsx("div", {
|
|
248
|
+
...props,
|
|
249
|
+
...htmlProps,
|
|
250
|
+
className,
|
|
251
|
+
"data-fs-product-information-description": "",
|
|
252
|
+
"data-fs-product-information-description-collapse": "none",
|
|
253
|
+
"data-fs-text": ""
|
|
254
|
+
});
|
|
255
|
+
return /* @__PURE__ */ jsx("p", {
|
|
256
|
+
...props,
|
|
257
|
+
className,
|
|
258
|
+
"data-fs-product-information-description": "",
|
|
259
|
+
"data-fs-product-information-description-collapse": "none",
|
|
260
|
+
"data-fs-text": "",
|
|
261
|
+
children: plain
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
return /* @__PURE__ */ jsx(DescriptionCollapsible, {
|
|
265
|
+
...props,
|
|
266
|
+
className,
|
|
267
|
+
collapse,
|
|
268
|
+
defaultExpanded,
|
|
269
|
+
collapsedLines,
|
|
270
|
+
moreLabel,
|
|
271
|
+
lessLabel,
|
|
272
|
+
htmlProps,
|
|
273
|
+
panelChildren
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
function DescriptionCollapsible({ collapse, defaultExpanded, collapsedLines, moreLabel, lessLabel, className, htmlProps, panelChildren, ...props }) {
|
|
277
|
+
const [open, setOpen] = useState(defaultExpanded);
|
|
278
|
+
const panelId = useId();
|
|
279
|
+
const clampStyle = collapse === "showMore" && !open ? {
|
|
280
|
+
display: "-webkit-box",
|
|
281
|
+
WebkitBoxOrient: "vertical",
|
|
282
|
+
WebkitLineClamp: Math.max(1, Math.floor(collapsedLines)),
|
|
283
|
+
overflow: "hidden"
|
|
284
|
+
} : void 0;
|
|
285
|
+
const triggerLabel = open ? lessLabel : moreLabel;
|
|
286
|
+
return /* @__PURE__ */ jsxs(Collapsible.Root, {
|
|
287
|
+
...props,
|
|
288
|
+
className,
|
|
289
|
+
open,
|
|
290
|
+
onOpenChange: setOpen,
|
|
291
|
+
"data-fs-product-information-description": "",
|
|
292
|
+
"data-fs-product-information-description-collapse": collapse,
|
|
293
|
+
children: [collapse === "section" ? /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
294
|
+
...htmlProps,
|
|
295
|
+
hiddenUntilFound: true,
|
|
296
|
+
keepMounted: true,
|
|
297
|
+
"data-fs-product-information-description-panel": "",
|
|
298
|
+
"data-fs-text": "",
|
|
299
|
+
children: panelChildren
|
|
300
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
301
|
+
...htmlProps,
|
|
302
|
+
id: panelId,
|
|
303
|
+
"data-fs-product-information-description-panel": "",
|
|
304
|
+
"data-fs-text": "",
|
|
305
|
+
style: clampStyle,
|
|
306
|
+
children: panelChildren
|
|
307
|
+
}), /* @__PURE__ */ jsx(Collapsible.Trigger, {
|
|
308
|
+
...collapse === "section" ? null : { "aria-controls": panelId },
|
|
309
|
+
"data-fs-product-information-description-trigger": "",
|
|
310
|
+
children: triggerLabel
|
|
311
|
+
})]
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
function ProductInformationBrand({ className, ...props }) {
|
|
315
|
+
const ctx = useProductInformation();
|
|
316
|
+
if (!ctx || !ctx.brand) return null;
|
|
317
|
+
return /* @__PURE__ */ jsx("span", {
|
|
318
|
+
...props,
|
|
319
|
+
className,
|
|
320
|
+
"data-fs-product-information-brand": "",
|
|
321
|
+
children: ctx.brand
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
function ProductInformationSku({ className, ...props }) {
|
|
325
|
+
const ctx = useProductInformation();
|
|
326
|
+
if (!ctx || !ctx.sku) return null;
|
|
327
|
+
return /* @__PURE__ */ jsx("span", {
|
|
328
|
+
...props,
|
|
329
|
+
className,
|
|
330
|
+
"data-fs-product-information-sku": "",
|
|
331
|
+
children: ctx.sku
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
function ProductInformationReferenceId({ className, ...props }) {
|
|
335
|
+
const ctx = useProductInformation();
|
|
336
|
+
if (!ctx || !ctx.referenceId) return null;
|
|
337
|
+
return /* @__PURE__ */ jsx("span", {
|
|
338
|
+
...props,
|
|
339
|
+
className,
|
|
340
|
+
"data-fs-product-information-reference-id": "",
|
|
341
|
+
children: ctx.referenceId
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
const ProductInformation = {
|
|
345
|
+
Root: ProductInformationRoot,
|
|
346
|
+
Title: ProductInformationTitle,
|
|
347
|
+
Description: ProductInformationDescription,
|
|
348
|
+
Brand: ProductInformationBrand,
|
|
349
|
+
Sku: ProductInformationSku,
|
|
350
|
+
ReferenceId: ProductInformationReferenceId
|
|
351
|
+
};
|
|
352
|
+
//#endregion
|
|
353
|
+
export { ProductInformation, ProductInformationBrand, ProductInformationBrandDefinition, ProductInformationDescription, ProductInformationDescriptionDefinition, ProductInformationReferenceId, ProductInformationReferenceIdDefinition, ProductInformationRoot, ProductInformationRootDefinition, ProductInformationSku, ProductInformationSkuDefinition, ProductInformationTitle, ProductInformationTitleDefinition };
|
|
354
|
+
|
|
355
|
+
//# sourceMappingURL=product-information.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-information.js","names":["Component"],"sources":["../../../src/matter/product-information/product-information.tsx"],"sourcesContent":["'use client';\n\nimport { Collapsible } from '@base-ui/react/collapsible';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithoutRef, ComponentPropsWithRef, CSSProperties } from 'react';\nimport { createContext, useContext, useEffect, useId, useRef, useState } from 'react';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { graphql } from '../../sdk/generated/gql.js';\nimport type { ProductInformationDataFragment } from '../../sdk/generated/graphql.js';\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment — typed via @graphql-codegen client-preset\n// ---------------------------------------------------------------------------\n\nconst fragment = graphql(`\n fragment ProductInformationData on Query {\n productBySlug(slug: $slug) {\n __typename\n id\n title\n description\n descriptionHtml\n referenceId\n vendor\n brand {\n __typename\n id\n name\n }\n variants(first: 1) {\n edges {\n node {\n __typename\n id\n sku\n name\n }\n }\n }\n seo {\n title\n }\n }\n }\n`);\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype ProductSlice = NonNullable<ProductInformationDataFragment['productBySlug']>;\n\ntype ProductInformationContextData = {\n title: string;\n description: string | null;\n descriptionHtml: string | null;\n referenceId: string | null;\n brand: string | null;\n sku: string | null;\n variantName: string | null;\n seoTitle: string | null;\n};\n\ntype ProductInformationContextValue = ProductInformationContextData | null;\n\nconst PRODUCT_INFORMATION_CONTEXT_UNSET = Symbol('ProductInformationContextUnset');\n\ntype TitleAs = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport type DescriptionFormat = 'auto' | 'plain' | 'html';\n\ntype Collapse = 'none' | 'showMore' | 'section';\n\nexport type ProductInformationRootProps = ComponentPropsWithRef<'div'> & {\n $data?: ProductSlice | null;\n};\n\nexport type ProductInformationTitleProps = Omit<ComponentPropsWithRef<'h1'>, 'children'> & {\n as?: TitleAs;\n separator?: string;\n};\n\n// `ComponentPropsWithoutRef` (not `WithRef`) because the wrapper element varies between `<p>`\n// and `<div>` depending on the resolved `format` branch. Exposing a `ref` typed for one element\n// would be unsound when the other branch resolves — the runtime element type and the\n// type-system promise would diverge silently. Refs are intentionally not part of the contract.\nexport type ProductInformationDescriptionProps = Omit<\n ComponentPropsWithoutRef<'div'>,\n 'children' | 'dangerouslySetInnerHTML'\n> & {\n /**\n * Controls how the description renders.\n * - `'auto'` (default) — prefers `descriptionHtml`; falls back to plain `description`; renders nothing when both are absent.\n * - `'plain'` — strict plain text from `description`; never reads `descriptionHtml`.\n * - `'html'` — strict rich HTML from `descriptionHtml` via `dangerouslySetInnerHTML`; renders nothing when absent (no fallback).\n *\n * Rich HTML is safe because Storefront API Core sanitizes `descriptionHtml` upstream.\n *\n * The rendered element follows from the resolved branch: plain text renders as `<p>`;\n * rich HTML renders as `<div>` (so block-level markup inside `descriptionHtml` remains valid DOM).\n * Both wrappers carry `data-fs-text=\"\"` so project-level `Text` typography cascades automatically.\n */\n format?: DescriptionFormat;\n collapse?: Collapse;\n defaultExpanded?: boolean;\n collapsedLines?: number;\n moreLabel?: string;\n lessLabel?: string;\n};\n\nexport type ProductInformationBrandProps = Omit<ComponentPropsWithRef<'span'>, 'children'>;\n\nexport type ProductInformationSkuProps = Omit<ComponentPropsWithRef<'span'>, 'children'>;\n\nexport type ProductInformationReferenceIdProps = Omit<ComponentPropsWithRef<'span'>, 'children'>;\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst ProductInformationContext = createContext<\n ProductInformationContextValue | typeof PRODUCT_INFORMATION_CONTEXT_UNSET\n>(PRODUCT_INFORMATION_CONTEXT_UNSET);\n\nfunction useProductInformation(): ProductInformationContextValue {\n const ctx = useContext(ProductInformationContext);\n if (ctx === PRODUCT_INFORMATION_CONTEXT_UNSET) {\n throw new Error('ProductInformation components must be used inside ProductInformationRoot.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Transform\n// ---------------------------------------------------------------------------\n\nfunction transformProductInformationData(data: ProductSlice): ProductInformationContextData {\n const brand = data.brand?.name ?? data.vendor ?? null;\n const firstVariant = data.variants.edges[0]?.node ?? null;\n const sku = firstVariant?.sku ?? null;\n const variantName = firstVariant?.name ?? null;\n const seoTitle = data.seo?.title ?? null;\n\n return {\n title: data.title,\n description: data.description,\n descriptionHtml: data.descriptionHtml,\n referenceId: data.referenceId,\n brand,\n sku,\n variantName,\n seoTitle,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const ProductInformationRootDefinition = defineComponent<ProductInformationRootProps>({\n name: 'ProductInformationRoot',\n importPath: '@vtex/faststore/components',\n component: ProductInformationRoot,\n fragment,\n fetchStrategy: 'reactive',\n editor: { label: 'Product Information', category: 'commerce' },\n schema: {},\n providesContext: 'product-information',\n guideline:\n 'Root container for PDP product text — wraps ProductInformationTitle, ProductInformationDescription, ProductInformationBrand, ProductInformationSku, and ProductInformationReferenceId (any subset, any order). See product-information.md.',\n});\n\nexport const ProductInformationTitleDefinition = defineComponent<ProductInformationTitleProps>({\n name: 'ProductInformationTitle',\n importPath: '@vtex/faststore/components',\n component: ProductInformationTitle,\n editor: { label: 'Product Title', category: 'commerce' },\n schema: {\n as: {\n type: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const,\n default: 'h1',\n label: 'Element tag',\n },\n separator: { type: 'string', label: 'Variant separator' },\n },\n requiresContext: 'product-information',\n guideline:\n 'Renders the product title inside a ProductInformationRoot (or any ancestor providing `product-information` context); `as` controls the heading level (`h1`–`h6`, default `h1`) and `separator` optionally appends the selected variant name.',\n});\n\nexport const ProductInformationDescriptionDefinition = defineComponent<ProductInformationDescriptionProps>({\n name: 'ProductInformationDescription',\n importPath: '@vtex/faststore/components',\n component: ProductInformationDescription,\n editor: { label: 'Product Description', category: 'commerce' },\n schema: {\n format: {\n type: ['auto', 'plain', 'html'] as const,\n default: 'auto',\n label: 'Description format',\n },\n collapse: {\n type: ['none', 'showMore', 'section'] as const,\n default: 'none',\n label: 'Collapse pattern',\n },\n defaultExpanded: { type: 'boolean', default: true, label: 'Expanded by default' },\n collapsedLines: { type: 'number', default: 4, label: 'Collapsed line count' },\n moreLabel: { type: 'string', default: 'Show more', label: 'Trigger label (collapsed)' },\n lessLabel: { type: 'string', default: 'Show less', label: 'Trigger label (expanded)' },\n },\n requiresContext: 'product-information',\n guideline:\n \"Renders the product description inside a ProductInformationRoot (or any ancestor providing `product-information` context); `format` selects the source (`'auto'` default prefers HTML, `'plain'` forces plain text, `'html'` forces HTML only); `collapse` selects the reveal pattern (`'none'` default, `'showMore'` inline line-clamp via `collapsedLines` with `moreLabel`/`lessLabel`, `'section'` Base UI Collapsible disclosure).\",\n});\n\nexport const ProductInformationBrandDefinition = defineComponent<ProductInformationBrandProps>({\n name: 'ProductInformationBrand',\n importPath: '@vtex/faststore/components',\n component: ProductInformationBrand,\n editor: { label: 'Product Brand', category: 'commerce' },\n schema: {},\n requiresContext: 'product-information',\n guideline:\n 'Renders the product brand name inside a ProductInformationRoot (or any ancestor providing `product-information` context); prefers `brand.name` and falls back to `vendor`.',\n});\n\nexport const ProductInformationSkuDefinition = defineComponent<ProductInformationSkuProps>({\n name: 'ProductInformationSku',\n importPath: '@vtex/faststore/components',\n component: ProductInformationSku,\n editor: { label: 'Product SKU', category: 'commerce' },\n schema: {},\n requiresContext: 'product-information',\n guideline:\n 'Renders the first-variant SKU code inside a ProductInformationRoot (or any ancestor providing `product-information` context).',\n});\n\nexport const ProductInformationReferenceIdDefinition = defineComponent<ProductInformationReferenceIdProps>({\n name: 'ProductInformationReferenceId',\n importPath: '@vtex/faststore/components',\n component: ProductInformationReferenceId,\n editor: { label: 'Product Reference ID', category: 'commerce' },\n schema: {},\n requiresContext: 'product-information',\n guideline:\n 'Renders the merchant reference ID inside a ProductInformationRoot (or any ancestor providing `product-information` context).',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\nexport function ProductInformationRoot({\n $data: $dataProp,\n className,\n children,\n ...props\n}: ProductInformationRootProps) {\n const $data = useDataOverride($dataProp);\n const contextValue = $data ? transformProductInformationData($data) : null;\n\n return (\n <ProductInformationContext value={contextValue}>\n <div {...props} className={className} data-fs-product-information=\"\">\n {children}\n </div>\n </ProductInformationContext>\n );\n}\n\nexport function ProductInformationTitle({ as = 'h1', separator, className, ...props }: ProductInformationTitleProps) {\n const ctx = useProductInformation();\n const variantName = ctx?.variantName ?? null;\n const warnedRef = useRef(false);\n const nullVariantSeenRef = useRef(false);\n\n // NFR-3: warn once in production when `separator` is set but `variantName` stays null across\n // commits (the SKU Selector gets one commit to hydrate before we conclude it's misconfigured).\n // No deps array: the persistence check needs to evaluate on every commit, independent of any\n // future memoization of the Root's context value.\n useEffect(() => {\n if (process.env.NODE_ENV !== 'production') return;\n if (separator === undefined || !ctx) return;\n\n if (variantName === null) {\n if (nullVariantSeenRef.current && !warnedRef.current) {\n warnedRef.current = true;\n console.warn(\n '[ProductInformationTitle] `separator` is set but the selected variant has no `name`; the title will render the product name alone. Ensure the SKU Selector wires Variant.name into the cache, or omit `separator` to silence this warning.',\n );\n }\n nullVariantSeenRef.current = true;\n return;\n }\n\n nullVariantSeenRef.current = false;\n });\n\n if (!ctx) return null;\n\n const composed = separator !== undefined && variantName ? `${ctx.title}${separator}${variantName}` : ctx.title;\n\n const Component = as;\n return (\n <Component\n {...props}\n className={className}\n data-fs-product-information-title=\"\"\n data-fs-product-information-title-as={as}\n >\n {composed}\n </Component>\n );\n}\n\nexport function ProductInformationDescription({\n format = 'auto',\n collapse = 'none',\n defaultExpanded = true,\n collapsedLines = 4,\n moreLabel = 'Show more',\n lessLabel = 'Show less',\n className,\n ...props\n}: ProductInformationDescriptionProps) {\n const ctx = useProductInformation();\n if (!ctx) return null;\n\n // `'auto'` accepts both branches and prefers HTML; `'html'` and `'plain'` are strict opt-ins.\n const wantsRich = format === 'auto' || format === 'html';\n const wantsPlain = format === 'auto' || format === 'plain';\n const htmlPayload = wantsRich ? ctx.descriptionHtml : null;\n const plain = wantsPlain ? ctx.description : null;\n if (!htmlPayload && !plain) return null;\n\n // `format='auto'|'html'` is the opt-in: `descriptionHtml` is expected to be sanitized upstream by storefront-api-core.\n const htmlProps = htmlPayload ? { dangerouslySetInnerHTML: { __html: htmlPayload } } : undefined;\n const panelChildren = htmlPayload ? undefined : plain;\n\n if (collapse === 'none') {\n if (htmlPayload) {\n return (\n <div\n {...props}\n {...htmlProps}\n className={className}\n data-fs-product-information-description=\"\"\n data-fs-product-information-description-collapse=\"none\"\n data-fs-text=\"\"\n />\n );\n }\n\n return (\n <p\n {...props}\n className={className}\n data-fs-product-information-description=\"\"\n data-fs-product-information-description-collapse=\"none\"\n data-fs-text=\"\"\n >\n {plain}\n </p>\n );\n }\n\n return (\n <DescriptionCollapsible\n {...props}\n className={className}\n collapse={collapse}\n defaultExpanded={defaultExpanded}\n collapsedLines={collapsedLines}\n moreLabel={moreLabel}\n lessLabel={lessLabel}\n htmlProps={htmlProps}\n panelChildren={panelChildren}\n />\n );\n}\n\ntype DescriptionCollapsibleProps = Omit<ComponentPropsWithRef<'div'>, 'children' | 'dangerouslySetInnerHTML'> & {\n collapse: Exclude<Collapse, 'none'>;\n defaultExpanded: boolean;\n collapsedLines: number;\n moreLabel: string;\n lessLabel: string;\n htmlProps: { dangerouslySetInnerHTML: { __html: string } } | undefined;\n panelChildren: string | null | undefined;\n};\n\nfunction DescriptionCollapsible({\n collapse,\n defaultExpanded,\n collapsedLines,\n moreLabel,\n lessLabel,\n className,\n htmlProps,\n panelChildren,\n ...props\n}: DescriptionCollapsibleProps) {\n const [open, setOpen] = useState(defaultExpanded);\n // Only the 'showMore' branch uses panelId — its panel is a plain <div> we own end-to-end,\n // so the trigger needs an explicit aria-controls. 'section' lets Base UI manage both the\n // panel id and the trigger's aria-controls (per APG Disclosure: aria-controls is only\n // required when the panel is open), which keeps the SSR HTML self-consistent without the\n // layout-effect hop that Collapsible.Panel uses to sync an external id.\n const panelId = useId();\n\n // `collapsedLines` is a free `number` at the schema level, so 0, negatives, and decimals\n // can reach the component. `-webkit-line-clamp` accepts an integer ≥ 1; anything else\n // either renders no lines (0, negative) or behaves inconsistently across engines (decimals).\n // Clamp here so invalid values fall back to the smallest visible state instead of leaking\n // into the inline style.\n const normalizedCollapsedLines = Math.max(1, Math.floor(collapsedLines));\n\n const clampStyle: CSSProperties | undefined =\n collapse === 'showMore' && !open\n ? {\n display: '-webkit-box',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: normalizedCollapsedLines,\n overflow: 'hidden',\n }\n : undefined;\n\n const triggerLabel = open ? lessLabel : moreLabel;\n\n return (\n <Collapsible.Root\n {...props}\n className={className}\n open={open}\n onOpenChange={setOpen}\n data-fs-product-information-description=\"\"\n data-fs-product-information-description-collapse={collapse}\n >\n {collapse === 'section' ? (\n <Collapsible.Panel\n {...htmlProps}\n hiddenUntilFound\n keepMounted\n data-fs-product-information-description-panel=\"\"\n data-fs-text=\"\"\n >\n {panelChildren}\n </Collapsible.Panel>\n ) : (\n <div\n {...htmlProps}\n id={panelId}\n data-fs-product-information-description-panel=\"\"\n data-fs-text=\"\"\n style={clampStyle}\n >\n {panelChildren}\n </div>\n )}\n <Collapsible.Trigger\n // Base UI's `mergeProps` writes every key from `elementProps`, including ones whose\n // value is `undefined` — passing `aria-controls={undefined}` would actively erase the\n // attribute Base UI installs on the trigger when the panel is open. Only attach our\n // own `aria-controls` for 'showMore', where we own the panel element directly.\n {...(collapse === 'section' ? null : { 'aria-controls': panelId })}\n data-fs-product-information-description-trigger=\"\"\n >\n {triggerLabel}\n </Collapsible.Trigger>\n </Collapsible.Root>\n );\n}\n\nexport function ProductInformationBrand({ className, ...props }: ProductInformationBrandProps) {\n const ctx = useProductInformation();\n if (!ctx || !ctx.brand) return null;\n\n return (\n <span {...props} className={className} data-fs-product-information-brand=\"\">\n {ctx.brand}\n </span>\n );\n}\n\nexport function ProductInformationSku({ className, ...props }: ProductInformationSkuProps) {\n const ctx = useProductInformation();\n if (!ctx || !ctx.sku) return null;\n\n return (\n <span {...props} className={className} data-fs-product-information-sku=\"\">\n {ctx.sku}\n </span>\n );\n}\n\nexport function ProductInformationReferenceId({ className, ...props }: ProductInformationReferenceIdProps) {\n const ctx = useProductInformation();\n if (!ctx || !ctx.referenceId) return null;\n\n return (\n <span {...props} className={className} data-fs-product-information-reference-id=\"\">\n {ctx.referenceId}\n </span>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Namespace export\n// ---------------------------------------------------------------------------\n\nexport const ProductInformation = {\n Root: ProductInformationRoot,\n Title: ProductInformationTitle,\n Description: ProductInformationDescription,\n Brand: ProductInformationBrand,\n Sku: ProductInformationSku,\n ReferenceId: ProductInformationReferenceId,\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { ComponentActions } from "../../sdk/actions/types.js";
|
|
4
|
+
import { ComponentPropsWithRef } from "react";
|
|
5
|
+
//#region src/matter/product-list/product-list.d.ts
|
|
6
|
+
export type ProductListItemImage = {
|
|
7
|
+
src: string;
|
|
8
|
+
alt: string;
|
|
9
|
+
};
|
|
10
|
+
export type ProductListItem = {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
image: ProductListItemImage;
|
|
14
|
+
price: number;
|
|
15
|
+
listPrice?: number;
|
|
16
|
+
variant?: string;
|
|
17
|
+
slug?: string;
|
|
18
|
+
spotPrice?: number;
|
|
19
|
+
tax?: number;
|
|
20
|
+
taxPercentage?: number | null;
|
|
21
|
+
availableForSale?: boolean;
|
|
22
|
+
availableQuantity?: number;
|
|
23
|
+
currency?: string;
|
|
24
|
+
};
|
|
25
|
+
export type ProductListRootProps = ComponentPropsWithRef<'div'> & {
|
|
26
|
+
products?: ProductListItem[];
|
|
27
|
+
/** When true, card prices render tax-inclusive (from the item's tax data). Default false. */
|
|
28
|
+
usePriceWithTaxes?: boolean;
|
|
29
|
+
/** Text for the tax label part when tax display is on. Default `'Tax included'`. */
|
|
30
|
+
taxesLabel?: string;
|
|
31
|
+
};
|
|
32
|
+
export type ProductListGridProps = ComponentPropsWithRef<'div'>;
|
|
33
|
+
export type ProductCardProps = ComponentPropsWithRef<'div'> & {
|
|
34
|
+
/** Toggles the card border. Reflects onto data-fs-product-card-bordered; a swatch draws the border. Default true. */
|
|
35
|
+
bordered?: boolean;
|
|
36
|
+
};
|
|
37
|
+
export type ProductCardImageProps = ComponentPropsWithRef<'img'> & {
|
|
38
|
+
objectFit?: 'contain' | 'cover' | 'fill' | 'none';
|
|
39
|
+
/** CSS `aspect-ratio` (e.g. `'1/1'`, `'3/4'`, `'16/9'`); lays out the image box, orthogonal to `objectFit`. */
|
|
40
|
+
aspectRatio?: string;
|
|
41
|
+
};
|
|
42
|
+
export type ProductCardNameProps = ComponentPropsWithRef<'span'>;
|
|
43
|
+
export type ProductCardPriceProps = ComponentPropsWithRef<'span'>;
|
|
44
|
+
export type ProductCardListPriceProps = ComponentPropsWithRef<'span'>;
|
|
45
|
+
export type ProductCardTaxLabelProps = ComponentPropsWithRef<'span'>;
|
|
46
|
+
export type ProductCardDiscountProps = ComponentPropsWithRef<'span'> & {
|
|
47
|
+
format?: 'percentage' | 'absolute';
|
|
48
|
+
};
|
|
49
|
+
export type ProductCardAddToCartProps = ComponentPropsWithRef<'button'> & {
|
|
50
|
+
/** Injected by the compiler from `actions: { cart: ['addItem'] }`; the cart write surface. */
|
|
51
|
+
$actions?: ComponentActions;
|
|
52
|
+
};
|
|
53
|
+
export declare const ProductListRootDefinition: ComponentDefinition<ProductListRootProps>;
|
|
54
|
+
export declare const ProductListGridDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
55
|
+
export declare const ProductCardDefinition: ComponentDefinition<ProductCardProps>;
|
|
56
|
+
export declare const ProductCardImageDefinition: ComponentDefinition<ProductCardImageProps>;
|
|
57
|
+
export declare const ProductCardNameDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
58
|
+
export declare const ProductCardPriceDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
59
|
+
export declare const ProductCardListPriceDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
60
|
+
export declare const ProductCardTaxLabelDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
61
|
+
export declare const ProductCardDiscountDefinition: ComponentDefinition<ProductCardDiscountProps>;
|
|
62
|
+
export declare const ProductCardAddToCartDefinition: ComponentDefinition<ProductCardAddToCartProps>;
|
|
63
|
+
export declare function ProductListRoot({ usePriceWithTaxes, taxesLabel, products, className, children, ...props }: ProductListRootProps): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
export declare function ProductListGrid({ className, children, ...props }: ProductListGridProps): import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
export declare function ProductCard({ className, children, bordered, ...props }: ProductCardProps): import("react/jsx-runtime").JSX.Element;
|
|
66
|
+
export declare function ProductCardImage({ className, objectFit, aspectRatio, ...props }: ProductCardImageProps): import("react/jsx-runtime").JSX.Element;
|
|
67
|
+
export declare function ProductCardName({ className, children, ...props }: ProductCardNameProps): import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
export declare function ProductCardPrice({ className, children, ...props }: ProductCardPriceProps): import("react/jsx-runtime").JSX.Element;
|
|
69
|
+
export declare function ProductCardListPrice({ className, children, ...props }: ProductCardListPriceProps): import("react/jsx-runtime").JSX.Element | null;
|
|
70
|
+
export declare function ProductCardTaxLabel({ className, children, ...props }: ProductCardTaxLabelProps): import("react/jsx-runtime").JSX.Element | null;
|
|
71
|
+
export declare function ProductCardDiscount({ className, children, format, ...props }: ProductCardDiscountProps): import("react/jsx-runtime").JSX.Element | null;
|
|
72
|
+
export declare function ProductCardAddToCart({ className, children, onClick, $actions, ...props }: ProductCardAddToCartProps): import("react/jsx-runtime").JSX.Element;
|
|
73
|
+
export declare const ProductList: {
|
|
74
|
+
Root: typeof ProductListRoot;
|
|
75
|
+
Grid: typeof ProductListGrid;
|
|
76
|
+
Card: typeof ProductCard;
|
|
77
|
+
CardImage: typeof ProductCardImage;
|
|
78
|
+
CardName: typeof ProductCardName;
|
|
79
|
+
CardPrice: typeof ProductCardPrice;
|
|
80
|
+
CardListPrice: typeof ProductCardListPrice;
|
|
81
|
+
CardTaxLabel: typeof ProductCardTaxLabel;
|
|
82
|
+
CardDiscount: typeof ProductCardDiscount;
|
|
83
|
+
CardAddToCart: typeof ProductCardAddToCart;
|
|
84
|
+
};
|
|
85
|
+
//#endregion
|
|
86
|
+
//# sourceMappingURL=product-list.d.ts.map
|