@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,920 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { DialogBackdrop, DialogClose, DialogPopup, DialogPortal, DialogRoot, DialogTitle, DialogViewport } from "../dialog/dialog.js";
|
|
5
|
+
import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/particles/gallery/gallery.tsx
|
|
8
|
+
const GalleryContext = createContext(null);
|
|
9
|
+
const GalleryItemContext = createContext(null);
|
|
10
|
+
const FullscreenTitleRegistryContext = createContext(null);
|
|
11
|
+
function useGallery() {
|
|
12
|
+
const ctx = useContext(GalleryContext);
|
|
13
|
+
if (!ctx) throw new Error("Gallery components must be used inside GalleryRoot.");
|
|
14
|
+
return ctx;
|
|
15
|
+
}
|
|
16
|
+
function useGalleryItem() {
|
|
17
|
+
const ctx = useContext(GalleryItemContext);
|
|
18
|
+
if (!ctx) throw new Error("GalleryThumbnail and GalleryOverflowCount must be used inside GalleryThumbnails.");
|
|
19
|
+
return ctx;
|
|
20
|
+
}
|
|
21
|
+
const GALLERY_DOC = "./gallery.md";
|
|
22
|
+
const GalleryRootDefinition = defineComponent({
|
|
23
|
+
name: "GalleryRoot",
|
|
24
|
+
importPath: "@vtex/faststore/components",
|
|
25
|
+
component: GalleryRoot,
|
|
26
|
+
editor: {
|
|
27
|
+
label: "Gallery Root",
|
|
28
|
+
category: "content"
|
|
29
|
+
},
|
|
30
|
+
schema: {
|
|
31
|
+
defaultIndex: {
|
|
32
|
+
type: "number",
|
|
33
|
+
default: 0,
|
|
34
|
+
label: "Default Index"
|
|
35
|
+
},
|
|
36
|
+
selectOnHover: {
|
|
37
|
+
type: "boolean",
|
|
38
|
+
default: false,
|
|
39
|
+
label: "Select on Hover"
|
|
40
|
+
},
|
|
41
|
+
thumbnailOpensFullscreen: {
|
|
42
|
+
type: "boolean",
|
|
43
|
+
default: false,
|
|
44
|
+
label: "Thumbnail Opens Fullscreen"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
guideline: "Root of the gallery. Manages selected media index, fullscreen state, and zoom state. Compose as: GalleryRoot > (GalleryMainMedia (or GalleryZoom > (GalleryMainMedia + GalleryZoomLens + GalleryZoomResult)) + GalleryThumbnails > [GalleryThumbnail + GalleryOverflowCount] + GalleryFullscreen > [GalleryFullscreenClose + GalleryPrevious + GalleryMainMedia + GalleryNext + GalleryThumbnails]). Set selectOnHover=true for hover-to-preview; thumbnailOpensFullscreen=true to open fullscreen on thumbnail click."
|
|
48
|
+
});
|
|
49
|
+
const GalleryMainMediaDefinition = defineComponent({
|
|
50
|
+
name: "GalleryMainMedia",
|
|
51
|
+
importPath: "@vtex/faststore/components",
|
|
52
|
+
component: GalleryMainMedia,
|
|
53
|
+
editor: {
|
|
54
|
+
label: "Gallery Main Media",
|
|
55
|
+
category: "content"
|
|
56
|
+
},
|
|
57
|
+
schema: {
|
|
58
|
+
objectFit: {
|
|
59
|
+
type: [
|
|
60
|
+
"contain",
|
|
61
|
+
"cover",
|
|
62
|
+
"fill",
|
|
63
|
+
"none"
|
|
64
|
+
],
|
|
65
|
+
default: "contain",
|
|
66
|
+
label: "Object Fit"
|
|
67
|
+
},
|
|
68
|
+
aspectRatio: {
|
|
69
|
+
type: "string",
|
|
70
|
+
default: "1 / 1",
|
|
71
|
+
label: "Aspect Ratio"
|
|
72
|
+
},
|
|
73
|
+
videoAutoPlay: {
|
|
74
|
+
type: "boolean",
|
|
75
|
+
default: false,
|
|
76
|
+
label: "Video Auto Play"
|
|
77
|
+
},
|
|
78
|
+
videoControls: {
|
|
79
|
+
type: "boolean",
|
|
80
|
+
default: true,
|
|
81
|
+
label: "Video Controls"
|
|
82
|
+
},
|
|
83
|
+
clickOpensFullscreen: {
|
|
84
|
+
type: "boolean",
|
|
85
|
+
default: false,
|
|
86
|
+
label: "Click Opens Fullscreen"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
guideline: "Renders the currently selected media item from GalleryRoot context: <img> for images, <video> for videos. Supports swipe gestures (50px threshold) to navigate. Set clickOpensFullscreen=true to open the fullscreen overlay on click. Must be inside GalleryRoot or GalleryZoom.",
|
|
90
|
+
docPath: GALLERY_DOC
|
|
91
|
+
});
|
|
92
|
+
const GalleryThumbnailsDefinition = defineComponent({
|
|
93
|
+
name: "GalleryThumbnails",
|
|
94
|
+
importPath: "@vtex/faststore/components",
|
|
95
|
+
component: GalleryThumbnails,
|
|
96
|
+
editor: {
|
|
97
|
+
label: "Gallery Thumbnails",
|
|
98
|
+
category: "content"
|
|
99
|
+
},
|
|
100
|
+
schema: {
|
|
101
|
+
maxVisible: {
|
|
102
|
+
type: "number",
|
|
103
|
+
label: "Max Visible"
|
|
104
|
+
},
|
|
105
|
+
slider: {
|
|
106
|
+
type: "boolean",
|
|
107
|
+
default: false,
|
|
108
|
+
label: "Slider Mode"
|
|
109
|
+
},
|
|
110
|
+
animated: {
|
|
111
|
+
type: "boolean",
|
|
112
|
+
default: false,
|
|
113
|
+
label: "Animated"
|
|
114
|
+
},
|
|
115
|
+
direction: {
|
|
116
|
+
type: ["horizontal", "vertical"],
|
|
117
|
+
default: "horizontal",
|
|
118
|
+
label: "Direction"
|
|
119
|
+
},
|
|
120
|
+
hideWhenSingle: {
|
|
121
|
+
type: "boolean",
|
|
122
|
+
default: true,
|
|
123
|
+
label: "Hide when single image"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
guideline: "Iterates media items and renders its children once per item. Returns null when there are 0 or 1 media items unless hideWhenSingle={false}. Set maxVisible to cap visible thumbnails. Without slider: last slot gets isOverflow=true for GalleryOverflowCount. With slider=true: window driven by GalleryThumbnailsPrevious/Next. Add animated=true for smooth scroll — also set direction to match the flex axis of the container.",
|
|
127
|
+
docPath: GALLERY_DOC
|
|
128
|
+
});
|
|
129
|
+
const GalleryThumbnailsPreviousDefinition = defineComponent({
|
|
130
|
+
name: "GalleryThumbnailsPrevious",
|
|
131
|
+
importPath: "@vtex/faststore/components",
|
|
132
|
+
component: GalleryThumbnailsPrevious,
|
|
133
|
+
editor: {
|
|
134
|
+
label: "Gallery Thumbnails Previous",
|
|
135
|
+
category: "content"
|
|
136
|
+
},
|
|
137
|
+
schema: { step: {
|
|
138
|
+
type: "number",
|
|
139
|
+
default: 1,
|
|
140
|
+
label: "Step"
|
|
141
|
+
} },
|
|
142
|
+
guideline: "Scrolls the thumbnail strip backward. Only active when GalleryThumbnails slider=true. Disabled at the first thumbnail. step=1 (default) moves one at a time; pass step equal to maxVisible to jump a full window. Place as sibling of GalleryThumbnails.",
|
|
143
|
+
docPath: GALLERY_DOC
|
|
144
|
+
});
|
|
145
|
+
const GalleryThumbnailsNextDefinition = defineComponent({
|
|
146
|
+
name: "GalleryThumbnailsNext",
|
|
147
|
+
importPath: "@vtex/faststore/components",
|
|
148
|
+
component: GalleryThumbnailsNext,
|
|
149
|
+
editor: {
|
|
150
|
+
label: "Gallery Thumbnails Next",
|
|
151
|
+
category: "content"
|
|
152
|
+
},
|
|
153
|
+
schema: { step: {
|
|
154
|
+
type: "number",
|
|
155
|
+
default: 1,
|
|
156
|
+
label: "Step"
|
|
157
|
+
} },
|
|
158
|
+
guideline: "Scrolls the thumbnail strip forward. Only active when GalleryThumbnails slider=true. Disabled at the last visible thumbnail. step=1 (default) moves one at a time; pass step equal to maxVisible to jump a full window. Place as sibling of GalleryThumbnails.",
|
|
159
|
+
docPath: GALLERY_DOC
|
|
160
|
+
});
|
|
161
|
+
const GalleryThumbnailDefinition = defineComponent({
|
|
162
|
+
name: "GalleryThumbnail",
|
|
163
|
+
importPath: "@vtex/faststore/components",
|
|
164
|
+
component: GalleryThumbnail,
|
|
165
|
+
editor: {
|
|
166
|
+
label: "Gallery Thumbnail",
|
|
167
|
+
category: "content"
|
|
168
|
+
},
|
|
169
|
+
schema: {
|
|
170
|
+
objectFit: {
|
|
171
|
+
type: [
|
|
172
|
+
"contain",
|
|
173
|
+
"cover",
|
|
174
|
+
"fill",
|
|
175
|
+
"none"
|
|
176
|
+
],
|
|
177
|
+
default: "contain",
|
|
178
|
+
label: "Object Fit"
|
|
179
|
+
},
|
|
180
|
+
aspectRatio: {
|
|
181
|
+
type: "string",
|
|
182
|
+
default: "1 / 1",
|
|
183
|
+
label: "Aspect Ratio"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
guideline: "Thumbnail button for a single media item. Reads from GalleryItemContext — must be inside GalleryThumbnails. Adds data-fs-gallery-thumbnail-selected=\"true\" when active. For videos, renders previewImageUrl as the thumbnail src.",
|
|
187
|
+
docPath: GALLERY_DOC
|
|
188
|
+
});
|
|
189
|
+
const GalleryOverflowCountDefinition = defineComponent({
|
|
190
|
+
name: "GalleryOverflowCount",
|
|
191
|
+
importPath: "@vtex/faststore/components",
|
|
192
|
+
component: GalleryOverflowCount,
|
|
193
|
+
editor: {
|
|
194
|
+
label: "Gallery Overflow Count",
|
|
195
|
+
category: "content"
|
|
196
|
+
},
|
|
197
|
+
schema: {
|
|
198
|
+
template: {
|
|
199
|
+
type: "string",
|
|
200
|
+
default: "+{count}",
|
|
201
|
+
label: "Template"
|
|
202
|
+
},
|
|
203
|
+
ariaLabel: {
|
|
204
|
+
type: "string",
|
|
205
|
+
default: "View all {total} images",
|
|
206
|
+
label: "Aria Label"
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
guideline: "Overflow indicator. Only renders when isOverflow=true in GalleryItemContext — place alongside GalleryThumbnail inside GalleryThumbnails. Clicking opens fullscreen. Use template=\"+{count}\" to customize the visible label. The rendered button carries an aria-label (default \"View all {total} images\") so screen readers announce the full action, not just the count.",
|
|
210
|
+
docPath: GALLERY_DOC
|
|
211
|
+
});
|
|
212
|
+
const GalleryMediaDefinition = defineComponent({
|
|
213
|
+
name: "GalleryMedia",
|
|
214
|
+
importPath: "@vtex/faststore/components",
|
|
215
|
+
component: GalleryMedia,
|
|
216
|
+
editor: {
|
|
217
|
+
label: "Gallery Media",
|
|
218
|
+
category: "content"
|
|
219
|
+
},
|
|
220
|
+
schema: {
|
|
221
|
+
objectFit: {
|
|
222
|
+
type: [
|
|
223
|
+
"contain",
|
|
224
|
+
"cover",
|
|
225
|
+
"fill",
|
|
226
|
+
"none"
|
|
227
|
+
],
|
|
228
|
+
default: "contain",
|
|
229
|
+
label: "Object Fit"
|
|
230
|
+
},
|
|
231
|
+
aspectRatio: {
|
|
232
|
+
type: "string",
|
|
233
|
+
default: "1 / 1",
|
|
234
|
+
label: "Aspect Ratio"
|
|
235
|
+
},
|
|
236
|
+
videoAutoPlay: {
|
|
237
|
+
type: "boolean",
|
|
238
|
+
default: false,
|
|
239
|
+
label: "Video Auto Play"
|
|
240
|
+
},
|
|
241
|
+
videoControls: {
|
|
242
|
+
type: "boolean",
|
|
243
|
+
default: true,
|
|
244
|
+
label: "Video Controls"
|
|
245
|
+
},
|
|
246
|
+
clickOpensFullscreen: {
|
|
247
|
+
type: "boolean",
|
|
248
|
+
default: false,
|
|
249
|
+
label: "Click Opens Fullscreen"
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
guideline: "Full-size media display for items inside GalleryThumbnails. Unlike GalleryThumbnail, renders as a div (not a button) — use for grid layouts and vertical fullscreen stacks. Set clickOpensFullscreen=true to select the item and open fullscreen on click. Must be inside GalleryThumbnails.",
|
|
253
|
+
docPath: GALLERY_DOC
|
|
254
|
+
});
|
|
255
|
+
const GalleryZoomDefinition = defineComponent({
|
|
256
|
+
name: "GalleryZoom",
|
|
257
|
+
importPath: "@vtex/faststore/components",
|
|
258
|
+
component: GalleryZoom,
|
|
259
|
+
editor: {
|
|
260
|
+
label: "Gallery Zoom",
|
|
261
|
+
category: "content"
|
|
262
|
+
},
|
|
263
|
+
schema: {
|
|
264
|
+
magnification: {
|
|
265
|
+
type: "number",
|
|
266
|
+
default: 2,
|
|
267
|
+
label: "Magnification"
|
|
268
|
+
},
|
|
269
|
+
lensSize: {
|
|
270
|
+
type: "number",
|
|
271
|
+
default: 150,
|
|
272
|
+
label: "Lens Size (px)"
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
guideline: "Zoom container. Wrap GalleryMainMedia inside it to activate zoom on pointer enter (images only, not videos). Place GalleryZoomLens as a sibling of GalleryMainMedia inside GalleryZoom for the cursor indicator. Place GalleryZoomResult anywhere in GalleryRoot — as a sibling of GalleryZoom (side-panel) or absolute inside GalleryZoom (on-image overlay). Set magnification to control zoom level (default 2).",
|
|
276
|
+
docPath: GALLERY_DOC
|
|
277
|
+
});
|
|
278
|
+
const GalleryZoomLensDefinition = defineComponent({
|
|
279
|
+
name: "GalleryZoomLens",
|
|
280
|
+
importPath: "@vtex/faststore/components",
|
|
281
|
+
component: GalleryZoomLens,
|
|
282
|
+
editor: {
|
|
283
|
+
label: "Gallery Zoom Lens",
|
|
284
|
+
category: "content"
|
|
285
|
+
},
|
|
286
|
+
schema: {},
|
|
287
|
+
guideline: "Cursor focus indicator inside GalleryZoom. Only renders when zoom is active. Must be inside GalleryZoom. Style as absolute-positioned square — uses CSS custom properties --zoom-x, --zoom-y, --lens-size for positioning.",
|
|
288
|
+
docPath: GALLERY_DOC
|
|
289
|
+
});
|
|
290
|
+
const GalleryZoomResultDefinition = defineComponent({
|
|
291
|
+
name: "GalleryZoomResult",
|
|
292
|
+
importPath: "@vtex/faststore/components",
|
|
293
|
+
component: GalleryZoomResult,
|
|
294
|
+
editor: {
|
|
295
|
+
label: "Gallery Zoom Result",
|
|
296
|
+
category: "content"
|
|
297
|
+
},
|
|
298
|
+
schema: {},
|
|
299
|
+
guideline: "Magnified view driven by cursor position from GalleryZoom context. Only renders when zoom is active on an image. Place as sibling of GalleryZoom for side-panel zoom, or absolute inside GalleryZoom for on-image zoom.",
|
|
300
|
+
docPath: GALLERY_DOC
|
|
301
|
+
});
|
|
302
|
+
const GalleryFullscreenDefinition = defineComponent({
|
|
303
|
+
name: "GalleryFullscreen",
|
|
304
|
+
importPath: "@vtex/faststore/components",
|
|
305
|
+
component: GalleryFullscreen,
|
|
306
|
+
editor: {
|
|
307
|
+
label: "Gallery Fullscreen",
|
|
308
|
+
category: "content"
|
|
309
|
+
},
|
|
310
|
+
schema: {},
|
|
311
|
+
guideline: "Fullscreen overlay controlled by GalleryRoot state. Opens via GalleryOverflowCount, GalleryFullscreenTrigger, or thumbnailOpensFullscreen=true. Wraps a Dialog internally — place GalleryFullscreenClose, GalleryPrevious, GalleryMainMedia, GalleryNext, and optionally GalleryThumbnails as children. If no GalleryFullscreenTitle is composed, a default sr-only \"Gallery\" title is rendered automatically so the dialog always has an accessible name. Must be inside GalleryRoot.",
|
|
312
|
+
docPath: GALLERY_DOC
|
|
313
|
+
});
|
|
314
|
+
const GalleryFullscreenTitleDefinition = defineComponent({
|
|
315
|
+
name: "GalleryFullscreenTitle",
|
|
316
|
+
importPath: "@vtex/faststore/components",
|
|
317
|
+
component: GalleryFullscreenTitle,
|
|
318
|
+
editor: {
|
|
319
|
+
label: "Gallery Fullscreen Title",
|
|
320
|
+
category: "content"
|
|
321
|
+
},
|
|
322
|
+
schema: {},
|
|
323
|
+
guideline: "Accessible title for the fullscreen dialog. Required for screen readers. Use sr-only to hide it visually or omit the class to display it. Must be inside GalleryFullscreen.",
|
|
324
|
+
docPath: GALLERY_DOC
|
|
325
|
+
});
|
|
326
|
+
const GalleryFullscreenCloseDefinition = defineComponent({
|
|
327
|
+
name: "GalleryFullscreenClose",
|
|
328
|
+
importPath: "@vtex/faststore/components",
|
|
329
|
+
component: GalleryFullscreenClose,
|
|
330
|
+
editor: {
|
|
331
|
+
label: "Gallery Fullscreen Close",
|
|
332
|
+
category: "content"
|
|
333
|
+
},
|
|
334
|
+
schema: {},
|
|
335
|
+
guideline: "Closes the fullscreen overlay. Must be inside GalleryFullscreen. Place at the top-right corner. Accepts any children (Icon, text).",
|
|
336
|
+
docPath: GALLERY_DOC
|
|
337
|
+
});
|
|
338
|
+
const GalleryPreviousDefinition = defineComponent({
|
|
339
|
+
name: "GalleryPrevious",
|
|
340
|
+
importPath: "@vtex/faststore/components",
|
|
341
|
+
component: GalleryPrevious,
|
|
342
|
+
editor: {
|
|
343
|
+
label: "Gallery Previous",
|
|
344
|
+
category: "content"
|
|
345
|
+
},
|
|
346
|
+
schema: { wrap: {
|
|
347
|
+
type: "boolean",
|
|
348
|
+
default: true,
|
|
349
|
+
label: "Wrap Around"
|
|
350
|
+
} },
|
|
351
|
+
guideline: "Navigates to the previous media item; wraps to the last by default, or stops at the first with wrap={false}. Use inside GalleryFullscreen or inline for carousel controls. Accepts any children (Icon, text).",
|
|
352
|
+
docPath: GALLERY_DOC
|
|
353
|
+
});
|
|
354
|
+
const GalleryNextDefinition = defineComponent({
|
|
355
|
+
name: "GalleryNext",
|
|
356
|
+
importPath: "@vtex/faststore/components",
|
|
357
|
+
component: GalleryNext,
|
|
358
|
+
editor: {
|
|
359
|
+
label: "Gallery Next",
|
|
360
|
+
category: "content"
|
|
361
|
+
},
|
|
362
|
+
schema: { wrap: {
|
|
363
|
+
type: "boolean",
|
|
364
|
+
default: true,
|
|
365
|
+
label: "Wrap Around"
|
|
366
|
+
} },
|
|
367
|
+
guideline: "Navigates to the next media item; wraps to the first by default, or stops at the last with wrap={false}. Use inside GalleryFullscreen or inline for carousel controls. Accepts any children (Icon, text).",
|
|
368
|
+
docPath: GALLERY_DOC
|
|
369
|
+
});
|
|
370
|
+
const GalleryMediaCountDefinition = defineComponent({
|
|
371
|
+
name: "GalleryMediaCount",
|
|
372
|
+
importPath: "@vtex/faststore/components",
|
|
373
|
+
component: GalleryMediaCount,
|
|
374
|
+
editor: {
|
|
375
|
+
label: "Gallery Media Count",
|
|
376
|
+
category: "content"
|
|
377
|
+
},
|
|
378
|
+
schema: { template: {
|
|
379
|
+
type: "string",
|
|
380
|
+
default: "{current} / {total}",
|
|
381
|
+
label: "Template"
|
|
382
|
+
} },
|
|
383
|
+
guideline: "Displays the current media position and total count (e.g. \"2 / 10\"). Use {current} and {total} placeholders in template. Place anywhere inside GalleryRoot — typically in GalleryFullscreen or above GalleryMainMedia.",
|
|
384
|
+
docPath: GALLERY_DOC
|
|
385
|
+
});
|
|
386
|
+
function GalleryRoot({ media = [], defaultIndex = 0, selectOnHover = false, thumbnailOpensFullscreen = false, children, ...props }) {
|
|
387
|
+
const [selectedIndex, setSelectedIndex] = useState(defaultIndex);
|
|
388
|
+
const [fullscreenOpen, setFullscreenOpen] = useState(false);
|
|
389
|
+
const [zoomActive, setZoomActive] = useState(false);
|
|
390
|
+
const [zoomPosition, setZoomPosition] = useState({
|
|
391
|
+
x: 0,
|
|
392
|
+
y: 0
|
|
393
|
+
});
|
|
394
|
+
const [zoomConfig, setZoomConfig] = useState({
|
|
395
|
+
magnification: 2,
|
|
396
|
+
lensSize: 150
|
|
397
|
+
});
|
|
398
|
+
const [zoomContainerSize, setZoomContainerSize] = useState({
|
|
399
|
+
width: 0,
|
|
400
|
+
height: 0
|
|
401
|
+
});
|
|
402
|
+
const [thumbnailOffset, setThumbnailOffset] = useState(0);
|
|
403
|
+
const [thumbnailsWindowSize, setThumbnailsWindowSize] = useState(0);
|
|
404
|
+
const openFullscreen = useCallback(() => setFullscreenOpen(true), []);
|
|
405
|
+
const closeFullscreen = useCallback(() => setFullscreenOpen(false), []);
|
|
406
|
+
const ctx = useMemo(() => ({
|
|
407
|
+
media,
|
|
408
|
+
selectedIndex,
|
|
409
|
+
setSelectedIndex,
|
|
410
|
+
fullscreenOpen,
|
|
411
|
+
openFullscreen,
|
|
412
|
+
closeFullscreen,
|
|
413
|
+
selectOnHover,
|
|
414
|
+
thumbnailOpensFullscreen,
|
|
415
|
+
zoomActive,
|
|
416
|
+
setZoomActive,
|
|
417
|
+
zoomPosition,
|
|
418
|
+
setZoomPosition,
|
|
419
|
+
magnification: zoomConfig.magnification,
|
|
420
|
+
lensSize: zoomConfig.lensSize,
|
|
421
|
+
setZoomConfig,
|
|
422
|
+
zoomContainerSize,
|
|
423
|
+
setZoomContainerSize,
|
|
424
|
+
thumbnailOffset,
|
|
425
|
+
setThumbnailOffset,
|
|
426
|
+
thumbnailsWindowSize,
|
|
427
|
+
setThumbnailsWindowSize
|
|
428
|
+
}), [
|
|
429
|
+
media,
|
|
430
|
+
selectedIndex,
|
|
431
|
+
fullscreenOpen,
|
|
432
|
+
openFullscreen,
|
|
433
|
+
closeFullscreen,
|
|
434
|
+
selectOnHover,
|
|
435
|
+
thumbnailOpensFullscreen,
|
|
436
|
+
zoomActive,
|
|
437
|
+
zoomPosition,
|
|
438
|
+
zoomConfig,
|
|
439
|
+
zoomContainerSize,
|
|
440
|
+
thumbnailOffset,
|
|
441
|
+
thumbnailsWindowSize
|
|
442
|
+
]);
|
|
443
|
+
return /* @__PURE__ */ jsx(GalleryContext, {
|
|
444
|
+
value: ctx,
|
|
445
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
446
|
+
...props,
|
|
447
|
+
"data-fs-gallery": "",
|
|
448
|
+
children
|
|
449
|
+
})
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
const SWIPE_THRESHOLD = 50;
|
|
453
|
+
function GalleryMainMedia({ objectFit = "contain", aspectRatio, videoAutoPlay = false, videoControls = true, clickOpensFullscreen = false, style, ...props }) {
|
|
454
|
+
const { media, selectedIndex, setSelectedIndex, openFullscreen } = useGallery();
|
|
455
|
+
const currentItem = media[selectedIndex] ?? media[0];
|
|
456
|
+
const pointerStartX = useRef(null);
|
|
457
|
+
function handlePointerDown(e) {
|
|
458
|
+
pointerStartX.current = e.clientX;
|
|
459
|
+
}
|
|
460
|
+
function handlePointerUp(e) {
|
|
461
|
+
if (pointerStartX.current === null) return;
|
|
462
|
+
const delta = e.clientX - pointerStartX.current;
|
|
463
|
+
pointerStartX.current = null;
|
|
464
|
+
if (Math.abs(delta) < SWIPE_THRESHOLD) {
|
|
465
|
+
if (clickOpensFullscreen) openFullscreen();
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (media.length === 0) return;
|
|
469
|
+
if (delta < 0) setSelectedIndex(selectedIndex < media.length - 1 ? selectedIndex + 1 : 0);
|
|
470
|
+
else setSelectedIndex(selectedIndex > 0 ? selectedIndex - 1 : media.length - 1);
|
|
471
|
+
}
|
|
472
|
+
if (!currentItem) return /* @__PURE__ */ jsx("div", {
|
|
473
|
+
...props,
|
|
474
|
+
"data-fs-gallery-main-media": ""
|
|
475
|
+
});
|
|
476
|
+
if (currentItem.type === "video") return /* @__PURE__ */ jsx("div", {
|
|
477
|
+
...props,
|
|
478
|
+
"data-fs-gallery-main-media": "",
|
|
479
|
+
"data-fs-gallery-main-media-type": "video",
|
|
480
|
+
children: /* @__PURE__ */ jsx("video", {
|
|
481
|
+
src: currentItem.url,
|
|
482
|
+
controls: videoControls,
|
|
483
|
+
autoPlay: videoAutoPlay,
|
|
484
|
+
poster: currentItem.previewImageUrl,
|
|
485
|
+
style: {
|
|
486
|
+
objectFit,
|
|
487
|
+
aspectRatio,
|
|
488
|
+
...style
|
|
489
|
+
},
|
|
490
|
+
children: /* @__PURE__ */ jsx("track", { kind: "captions" })
|
|
491
|
+
})
|
|
492
|
+
});
|
|
493
|
+
return /* @__PURE__ */ jsx("div", {
|
|
494
|
+
...props,
|
|
495
|
+
"data-fs-gallery-main-media": "",
|
|
496
|
+
"data-fs-gallery-main-media-type": "image",
|
|
497
|
+
onPointerDown: handlePointerDown,
|
|
498
|
+
onPointerUp: handlePointerUp,
|
|
499
|
+
style: {
|
|
500
|
+
touchAction: "pan-y",
|
|
501
|
+
...style
|
|
502
|
+
},
|
|
503
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
504
|
+
src: currentItem.url,
|
|
505
|
+
alt: currentItem.altText,
|
|
506
|
+
style: {
|
|
507
|
+
display: "block",
|
|
508
|
+
width: "100%",
|
|
509
|
+
objectFit,
|
|
510
|
+
aspectRatio
|
|
511
|
+
},
|
|
512
|
+
draggable: false
|
|
513
|
+
})
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
function GalleryThumbnails({ hideWhenSingle = true, ...rest }) {
|
|
517
|
+
const { media } = useGallery();
|
|
518
|
+
if (hideWhenSingle && media.length <= 1) return null;
|
|
519
|
+
return /* @__PURE__ */ jsx(GalleryThumbnailsInner, { ...rest });
|
|
520
|
+
}
|
|
521
|
+
function GalleryThumbnailsInner({ maxVisible, slider = false, animated = false, direction = "horizontal", children, style, ...props }) {
|
|
522
|
+
const { media, thumbnailOffset, setThumbnailsWindowSize } = useGallery();
|
|
523
|
+
const trackRef = useRef(null);
|
|
524
|
+
const [containerSize, setContainerSize] = useState(null);
|
|
525
|
+
useEffect(() => {
|
|
526
|
+
if (slider && maxVisible != null) setThumbnailsWindowSize(maxVisible);
|
|
527
|
+
}, [
|
|
528
|
+
slider,
|
|
529
|
+
maxVisible,
|
|
530
|
+
setThumbnailsWindowSize
|
|
531
|
+
]);
|
|
532
|
+
useLayoutEffect(() => {
|
|
533
|
+
if (!animated || !slider || maxVisible == null || !trackRef.current) return;
|
|
534
|
+
const lastVisible = trackRef.current.children[maxVisible - 1];
|
|
535
|
+
if (!lastVisible) return;
|
|
536
|
+
const size = direction === "horizontal" ? lastVisible.offsetLeft + lastVisible.offsetWidth : lastVisible.offsetTop + lastVisible.offsetHeight;
|
|
537
|
+
setContainerSize(size);
|
|
538
|
+
}, [
|
|
539
|
+
animated,
|
|
540
|
+
slider,
|
|
541
|
+
maxVisible,
|
|
542
|
+
direction
|
|
543
|
+
]);
|
|
544
|
+
useEffect(() => {
|
|
545
|
+
if (!animated || !slider || !trackRef.current) return;
|
|
546
|
+
const target = trackRef.current.children[thumbnailOffset];
|
|
547
|
+
if (!target) return;
|
|
548
|
+
trackRef.current.scrollTo({
|
|
549
|
+
left: direction === "horizontal" ? target.offsetLeft : 0,
|
|
550
|
+
top: direction === "vertical" ? target.offsetTop : 0,
|
|
551
|
+
behavior: "smooth"
|
|
552
|
+
});
|
|
553
|
+
}, [
|
|
554
|
+
thumbnailOffset,
|
|
555
|
+
animated,
|
|
556
|
+
slider,
|
|
557
|
+
direction
|
|
558
|
+
]);
|
|
559
|
+
const visibleItems = (() => {
|
|
560
|
+
if (animated && slider) return media;
|
|
561
|
+
if (maxVisible == null) return media;
|
|
562
|
+
if (slider) return media.slice(thumbnailOffset, thumbnailOffset + maxVisible);
|
|
563
|
+
return media.slice(0, maxVisible);
|
|
564
|
+
})();
|
|
565
|
+
const containerStyle = animated && slider ? {
|
|
566
|
+
overflow: "hidden",
|
|
567
|
+
position: "relative",
|
|
568
|
+
...direction === "horizontal" && containerSize != null ? { width: containerSize } : {},
|
|
569
|
+
...direction === "vertical" && containerSize != null ? { height: containerSize } : {},
|
|
570
|
+
...style
|
|
571
|
+
} : { ...style };
|
|
572
|
+
return /* @__PURE__ */ jsx("div", {
|
|
573
|
+
...props,
|
|
574
|
+
ref: trackRef,
|
|
575
|
+
style: containerStyle,
|
|
576
|
+
"data-fs-gallery-thumbnails": "",
|
|
577
|
+
children: visibleItems.map((item, slotIndex) => {
|
|
578
|
+
const index = animated && slider ? slotIndex : slider ? thumbnailOffset + slotIndex : slotIndex;
|
|
579
|
+
const isOverflow = !slider && maxVisible != null && media.length > maxVisible && slotIndex === maxVisible - 1;
|
|
580
|
+
const overflowCount = isOverflow ? media.length - maxVisible + 1 : 0;
|
|
581
|
+
return /* @__PURE__ */ jsx(GalleryItemContext, {
|
|
582
|
+
value: {
|
|
583
|
+
item,
|
|
584
|
+
index,
|
|
585
|
+
isOverflow,
|
|
586
|
+
overflowCount
|
|
587
|
+
},
|
|
588
|
+
children
|
|
589
|
+
}, index);
|
|
590
|
+
})
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
function GalleryThumbnail({ objectFit = "contain", aspectRatio, style, ...props }) {
|
|
594
|
+
const { selectedIndex, setSelectedIndex, openFullscreen, selectOnHover, thumbnailOpensFullscreen } = useGallery();
|
|
595
|
+
const { item, index, isOverflow } = useGalleryItem();
|
|
596
|
+
const thumbSrc = item.type === "video" ? item.previewImageUrl ?? "" : item.url;
|
|
597
|
+
function handleClick() {
|
|
598
|
+
setSelectedIndex(index);
|
|
599
|
+
if (thumbnailOpensFullscreen || isOverflow) openFullscreen();
|
|
600
|
+
}
|
|
601
|
+
function handlePointerEnter() {
|
|
602
|
+
if (selectOnHover && !isOverflow) setSelectedIndex(index);
|
|
603
|
+
}
|
|
604
|
+
return /* @__PURE__ */ jsx("button", {
|
|
605
|
+
type: "button",
|
|
606
|
+
onClick: handleClick,
|
|
607
|
+
onPointerEnter: handlePointerEnter,
|
|
608
|
+
"data-fs-gallery-thumbnail": "",
|
|
609
|
+
"data-fs-gallery-thumbnail-selected": String(index === selectedIndex),
|
|
610
|
+
"data-fs-gallery-thumbnail-type": item.type,
|
|
611
|
+
...props,
|
|
612
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
613
|
+
src: thumbSrc,
|
|
614
|
+
alt: item.altText,
|
|
615
|
+
style: {
|
|
616
|
+
display: "block",
|
|
617
|
+
width: "100%",
|
|
618
|
+
height: "100%",
|
|
619
|
+
objectFit,
|
|
620
|
+
aspectRatio,
|
|
621
|
+
...style
|
|
622
|
+
}
|
|
623
|
+
})
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
function GalleryOverflowCount({ template = "+{count}", ariaLabel = "View all {total} images", ...props }) {
|
|
627
|
+
const { media, openFullscreen } = useGallery();
|
|
628
|
+
const { isOverflow, overflowCount } = useGalleryItem();
|
|
629
|
+
if (!isOverflow) return null;
|
|
630
|
+
const label = template.replace("{count}", String(overflowCount));
|
|
631
|
+
const resolvedAriaLabel = ariaLabel.replace("{total}", String(media.length));
|
|
632
|
+
return /* @__PURE__ */ jsx("button", {
|
|
633
|
+
type: "button",
|
|
634
|
+
onClick: openFullscreen,
|
|
635
|
+
"aria-label": resolvedAriaLabel,
|
|
636
|
+
"data-fs-gallery-overflow-count": "",
|
|
637
|
+
...props,
|
|
638
|
+
children: label
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
function GalleryMedia({ objectFit = "contain", aspectRatio, videoAutoPlay = false, videoControls = true, clickOpensFullscreen = false, style, ...props }) {
|
|
642
|
+
const { setSelectedIndex, openFullscreen } = useGallery();
|
|
643
|
+
const { item, index } = useGalleryItem();
|
|
644
|
+
function handleClick() {
|
|
645
|
+
setSelectedIndex(index);
|
|
646
|
+
openFullscreen();
|
|
647
|
+
}
|
|
648
|
+
function handleKeyDown(e) {
|
|
649
|
+
if (e.key === "Enter" || e.key === " ") handleClick();
|
|
650
|
+
}
|
|
651
|
+
const interactiveProps = clickOpensFullscreen ? {
|
|
652
|
+
onClick: handleClick,
|
|
653
|
+
onKeyDown: handleKeyDown,
|
|
654
|
+
role: "button",
|
|
655
|
+
tabIndex: 0
|
|
656
|
+
} : {};
|
|
657
|
+
const wrapperStyle = {
|
|
658
|
+
...style,
|
|
659
|
+
...aspectRatio ? {
|
|
660
|
+
aspectRatio,
|
|
661
|
+
position: "relative"
|
|
662
|
+
} : {}
|
|
663
|
+
};
|
|
664
|
+
const mediaStyle = aspectRatio ? {
|
|
665
|
+
position: "absolute",
|
|
666
|
+
inset: 0,
|
|
667
|
+
width: "100%",
|
|
668
|
+
height: "100%",
|
|
669
|
+
objectFit
|
|
670
|
+
} : {
|
|
671
|
+
display: "block",
|
|
672
|
+
width: "100%",
|
|
673
|
+
height: "100%",
|
|
674
|
+
objectFit
|
|
675
|
+
};
|
|
676
|
+
if (item.type === "video") return /* @__PURE__ */ jsx("div", {
|
|
677
|
+
...props,
|
|
678
|
+
...interactiveProps,
|
|
679
|
+
style: wrapperStyle,
|
|
680
|
+
"data-fs-gallery-media-item": "",
|
|
681
|
+
"data-fs-gallery-media-item-type": "video",
|
|
682
|
+
children: /* @__PURE__ */ jsx("video", {
|
|
683
|
+
src: item.url,
|
|
684
|
+
controls: videoControls,
|
|
685
|
+
autoPlay: videoAutoPlay,
|
|
686
|
+
poster: item.previewImageUrl,
|
|
687
|
+
style: mediaStyle,
|
|
688
|
+
children: /* @__PURE__ */ jsx("track", { kind: "captions" })
|
|
689
|
+
})
|
|
690
|
+
});
|
|
691
|
+
return /* @__PURE__ */ jsx("div", {
|
|
692
|
+
...props,
|
|
693
|
+
...interactiveProps,
|
|
694
|
+
style: wrapperStyle,
|
|
695
|
+
"data-fs-gallery-media-item": "",
|
|
696
|
+
"data-fs-gallery-media-item-type": "image",
|
|
697
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
698
|
+
src: item.url,
|
|
699
|
+
alt: item.altText,
|
|
700
|
+
style: mediaStyle,
|
|
701
|
+
draggable: false
|
|
702
|
+
})
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
function GalleryZoom({ magnification = 2, lensSize = 150, children, ...props }) {
|
|
706
|
+
const { media, selectedIndex, setZoomActive, setZoomPosition, setZoomConfig, setZoomContainerSize } = useGallery();
|
|
707
|
+
const containerRef = useRef(null);
|
|
708
|
+
const isImage = media[selectedIndex]?.type === "image";
|
|
709
|
+
function handlePointerMove(e) {
|
|
710
|
+
if (!containerRef.current || !isImage) return;
|
|
711
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
712
|
+
const x = (e.clientX - rect.left) / rect.width;
|
|
713
|
+
const y = (e.clientY - rect.top) / rect.height;
|
|
714
|
+
setZoomPosition({
|
|
715
|
+
x: Math.max(0, Math.min(1, x)),
|
|
716
|
+
y: Math.max(0, Math.min(1, y))
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
function handlePointerEnter() {
|
|
720
|
+
setZoomConfig({
|
|
721
|
+
magnification,
|
|
722
|
+
lensSize
|
|
723
|
+
});
|
|
724
|
+
if (containerRef.current) {
|
|
725
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
726
|
+
setZoomContainerSize({
|
|
727
|
+
width: rect.width,
|
|
728
|
+
height: rect.height
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
if (isImage) setZoomActive(true);
|
|
732
|
+
}
|
|
733
|
+
function handlePointerLeave() {
|
|
734
|
+
setZoomActive(false);
|
|
735
|
+
}
|
|
736
|
+
return /* @__PURE__ */ jsx("div", {
|
|
737
|
+
ref: containerRef,
|
|
738
|
+
...props,
|
|
739
|
+
onPointerMove: handlePointerMove,
|
|
740
|
+
onPointerEnter: handlePointerEnter,
|
|
741
|
+
onPointerLeave: handlePointerLeave,
|
|
742
|
+
"data-fs-gallery-zoom": "",
|
|
743
|
+
children
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
function GalleryZoomLens({ style, ...props }) {
|
|
747
|
+
const { zoomActive, zoomPosition, lensSize, zoomContainerSize } = useGallery();
|
|
748
|
+
if (!zoomActive) return null;
|
|
749
|
+
const { width, height } = zoomContainerSize;
|
|
750
|
+
const maxLeft = Math.max(0, width - lensSize);
|
|
751
|
+
const maxTop = Math.max(0, height - lensSize);
|
|
752
|
+
const left = width > 0 ? Math.min(Math.max(zoomPosition.x * width - lensSize / 2, 0), maxLeft) : 0;
|
|
753
|
+
const lensStyle = {
|
|
754
|
+
top: height > 0 ? Math.min(Math.max(zoomPosition.y * height - lensSize / 2, 0), maxTop) : 0,
|
|
755
|
+
left,
|
|
756
|
+
width: lensSize,
|
|
757
|
+
height: lensSize,
|
|
758
|
+
...style
|
|
759
|
+
};
|
|
760
|
+
return /* @__PURE__ */ jsx("div", {
|
|
761
|
+
...props,
|
|
762
|
+
style: lensStyle,
|
|
763
|
+
"data-fs-gallery-zoom-lens": ""
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
function GalleryZoomResult({ style, ...props }) {
|
|
767
|
+
const { media, selectedIndex, zoomActive, zoomPosition, magnification } = useGallery();
|
|
768
|
+
const currentItem = media[selectedIndex];
|
|
769
|
+
const resultStyle = zoomActive && !!currentItem && currentItem.type === "image" ? {
|
|
770
|
+
backgroundImage: `url(${currentItem.url})`,
|
|
771
|
+
backgroundSize: `${magnification * 100}%`,
|
|
772
|
+
backgroundPosition: `${zoomPosition.x * 100}% ${zoomPosition.y * 100}%`,
|
|
773
|
+
backgroundRepeat: "no-repeat",
|
|
774
|
+
...style
|
|
775
|
+
} : {
|
|
776
|
+
visibility: "hidden",
|
|
777
|
+
...style
|
|
778
|
+
};
|
|
779
|
+
return /* @__PURE__ */ jsx("div", {
|
|
780
|
+
...props,
|
|
781
|
+
style: resultStyle,
|
|
782
|
+
"data-fs-gallery-zoom-result": ""
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
function GalleryFullscreen({ children, ...props }) {
|
|
786
|
+
const { fullscreenOpen, closeFullscreen } = useGallery();
|
|
787
|
+
const [hasExplicitTitle, setHasExplicitTitle] = useState(false);
|
|
788
|
+
const register = useCallback(() => setHasExplicitTitle(true), []);
|
|
789
|
+
const registry = useMemo(() => ({ register }), [register]);
|
|
790
|
+
return /* @__PURE__ */ jsx(DialogRoot, {
|
|
791
|
+
open: fullscreenOpen,
|
|
792
|
+
onOpenChange: (open) => {
|
|
793
|
+
if (!open) closeFullscreen();
|
|
794
|
+
},
|
|
795
|
+
children: /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogBackdrop, {
|
|
796
|
+
className: "fixed inset-0 bg-black/80",
|
|
797
|
+
"data-fs-gallery-fullscreen-backdrop": ""
|
|
798
|
+
}), /* @__PURE__ */ jsx(DialogViewport, {
|
|
799
|
+
className: "fixed inset-0 flex items-center justify-center",
|
|
800
|
+
children: /* @__PURE__ */ jsx(DialogPopup, {
|
|
801
|
+
...props,
|
|
802
|
+
"data-fs-gallery-fullscreen": "",
|
|
803
|
+
children: /* @__PURE__ */ jsxs(FullscreenTitleRegistryContext.Provider, {
|
|
804
|
+
value: registry,
|
|
805
|
+
children: [!hasExplicitTitle && /* @__PURE__ */ jsx(DialogTitle, {
|
|
806
|
+
className: "sr-only",
|
|
807
|
+
"data-fs-gallery-fullscreen-title": "",
|
|
808
|
+
children: "Gallery"
|
|
809
|
+
}), children]
|
|
810
|
+
})
|
|
811
|
+
})
|
|
812
|
+
})] })
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
function GalleryFullscreenTitle({ children = "Gallery", ...props }) {
|
|
816
|
+
const registry = useContext(FullscreenTitleRegistryContext);
|
|
817
|
+
useLayoutEffect(() => {
|
|
818
|
+
registry?.register();
|
|
819
|
+
}, [registry]);
|
|
820
|
+
return /* @__PURE__ */ jsx(DialogTitle, {
|
|
821
|
+
"data-fs-gallery-fullscreen-title": "",
|
|
822
|
+
...props,
|
|
823
|
+
children
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
function GalleryFullscreenClose({ children, ...props }) {
|
|
827
|
+
return /* @__PURE__ */ jsx(DialogClose, {
|
|
828
|
+
"data-fs-gallery-fullscreen-close": "",
|
|
829
|
+
...props,
|
|
830
|
+
children
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
function GalleryPrevious({ children, wrap = true, ...props }) {
|
|
834
|
+
const { media, selectedIndex, setSelectedIndex } = useGallery();
|
|
835
|
+
function handleClick() {
|
|
836
|
+
if (media.length === 0) return;
|
|
837
|
+
if (selectedIndex > 0) setSelectedIndex(selectedIndex - 1);
|
|
838
|
+
else if (wrap) setSelectedIndex(media.length - 1);
|
|
839
|
+
}
|
|
840
|
+
return /* @__PURE__ */ jsx("button", {
|
|
841
|
+
type: "button",
|
|
842
|
+
disabled: media.length === 0 || !wrap && selectedIndex === 0,
|
|
843
|
+
onClick: handleClick,
|
|
844
|
+
"data-fs-gallery-previous": "",
|
|
845
|
+
...props,
|
|
846
|
+
children
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
function GalleryNext({ children, wrap = true, ...props }) {
|
|
850
|
+
const { media, selectedIndex, setSelectedIndex } = useGallery();
|
|
851
|
+
function handleClick() {
|
|
852
|
+
if (media.length === 0) return;
|
|
853
|
+
if (selectedIndex < media.length - 1) setSelectedIndex(selectedIndex + 1);
|
|
854
|
+
else if (wrap) setSelectedIndex(0);
|
|
855
|
+
}
|
|
856
|
+
return /* @__PURE__ */ jsx("button", {
|
|
857
|
+
type: "button",
|
|
858
|
+
disabled: media.length === 0 || !wrap && selectedIndex === media.length - 1,
|
|
859
|
+
onClick: handleClick,
|
|
860
|
+
"data-fs-gallery-next": "",
|
|
861
|
+
...props,
|
|
862
|
+
children
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
function GalleryThumbnailsPrevious({ step = 1, children, ...props }) {
|
|
866
|
+
const { thumbnailOffset, setThumbnailOffset } = useGallery();
|
|
867
|
+
return /* @__PURE__ */ jsx("button", {
|
|
868
|
+
type: "button",
|
|
869
|
+
disabled: thumbnailOffset === 0,
|
|
870
|
+
onClick: () => setThumbnailOffset(Math.max(0, thumbnailOffset - step)),
|
|
871
|
+
"data-fs-gallery-thumbnails-previous": "",
|
|
872
|
+
...props,
|
|
873
|
+
children
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
function GalleryThumbnailsNext({ step = 1, children, ...props }) {
|
|
877
|
+
const { media, thumbnailOffset, setThumbnailOffset, thumbnailsWindowSize } = useGallery();
|
|
878
|
+
const isDisabled = thumbnailsWindowSize > 0 && thumbnailOffset + thumbnailsWindowSize >= media.length;
|
|
879
|
+
const maxOffset = Math.max(0, media.length - thumbnailsWindowSize);
|
|
880
|
+
return /* @__PURE__ */ jsx("button", {
|
|
881
|
+
type: "button",
|
|
882
|
+
disabled: isDisabled,
|
|
883
|
+
onClick: () => setThumbnailOffset(Math.min(maxOffset, thumbnailOffset + step)),
|
|
884
|
+
"data-fs-gallery-thumbnails-next": "",
|
|
885
|
+
...props,
|
|
886
|
+
children
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
function GalleryMediaCount({ template = "{current} / {total}", ...props }) {
|
|
890
|
+
const { selectedIndex, media } = useGallery();
|
|
891
|
+
const label = template.replace("{current}", String(selectedIndex + 1)).replace("{total}", String(media.length));
|
|
892
|
+
return /* @__PURE__ */ jsx("span", {
|
|
893
|
+
"data-fs-gallery-media-count": "",
|
|
894
|
+
...props,
|
|
895
|
+
children: label
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
const Gallery = {
|
|
899
|
+
Root: GalleryRoot,
|
|
900
|
+
MainMedia: GalleryMainMedia,
|
|
901
|
+
Media: GalleryMedia,
|
|
902
|
+
Thumbnails: GalleryThumbnails,
|
|
903
|
+
ThumbnailsPrevious: GalleryThumbnailsPrevious,
|
|
904
|
+
ThumbnailsNext: GalleryThumbnailsNext,
|
|
905
|
+
Thumbnail: GalleryThumbnail,
|
|
906
|
+
OverflowCount: GalleryOverflowCount,
|
|
907
|
+
Zoom: GalleryZoom,
|
|
908
|
+
ZoomLens: GalleryZoomLens,
|
|
909
|
+
ZoomResult: GalleryZoomResult,
|
|
910
|
+
Fullscreen: GalleryFullscreen,
|
|
911
|
+
FullscreenTitle: GalleryFullscreenTitle,
|
|
912
|
+
FullscreenClose: GalleryFullscreenClose,
|
|
913
|
+
Previous: GalleryPrevious,
|
|
914
|
+
Next: GalleryNext,
|
|
915
|
+
MediaCount: GalleryMediaCount
|
|
916
|
+
};
|
|
917
|
+
//#endregion
|
|
918
|
+
export { Gallery, GalleryFullscreen, GalleryFullscreenClose, GalleryFullscreenCloseDefinition, GalleryFullscreenDefinition, GalleryFullscreenTitle, GalleryFullscreenTitleDefinition, GalleryItemContext, GalleryMainMedia, GalleryMainMediaDefinition, GalleryMedia, GalleryMediaCount, GalleryMediaCountDefinition, GalleryMediaDefinition, GalleryNext, GalleryNextDefinition, GalleryOverflowCount, GalleryOverflowCountDefinition, GalleryPrevious, GalleryPreviousDefinition, GalleryRoot, GalleryRootDefinition, GalleryThumbnail, GalleryThumbnailDefinition, GalleryThumbnails, GalleryThumbnailsDefinition, GalleryThumbnailsNext, GalleryThumbnailsNextDefinition, GalleryThumbnailsPrevious, GalleryThumbnailsPreviousDefinition, GalleryZoom, GalleryZoomDefinition, GalleryZoomLens, GalleryZoomLensDefinition, GalleryZoomResult, GalleryZoomResultDefinition, useGallery, useGalleryItem };
|
|
919
|
+
|
|
920
|
+
//# sourceMappingURL=gallery.js.map
|