@athoscommerce/snap-preact 1.11.0 → 1.12.0
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/dist/cjs/components/src/components/Atoms/Dropdown/Dropdown.js +18 -10
- package/dist/cjs/components/src/components/Atoms/Image/Image.js +10 -2
- package/dist/cjs/components/src/components/Atoms/ProductDetail/ProductDetail.js +98 -0
- package/dist/cjs/components/src/components/Atoms/ProductDetail/index.js +7 -0
- package/dist/cjs/components/src/components/Atoms/TemplateSelect/TemplateSelect.js +13 -4
- package/dist/cjs/components/src/components/Molecules/CalloutBadge/CalloutBadge.js +4 -1
- package/dist/cjs/components/src/components/Molecules/Gallery/Gallery.js +298 -0
- package/dist/cjs/components/src/components/Molecules/Gallery/index.js +17 -0
- package/dist/cjs/components/src/components/Molecules/Modal/Modal.js +21 -2
- package/dist/cjs/components/src/components/Molecules/OverlayBadge/OverlayBadge.js +1 -1
- package/dist/cjs/components/src/components/Molecules/ProductDetailTable/ProductDetailTable.js +115 -0
- package/dist/cjs/components/src/components/Molecules/ProductDetailTable/index.js +17 -0
- package/dist/cjs/components/src/components/Molecules/QuantityPicker/QuantityPicker.js +136 -0
- package/dist/cjs/components/src/components/Molecules/QuantityPicker/index.js +17 -0
- package/dist/cjs/components/src/components/Molecules/Result/Result.js +43 -4
- package/dist/cjs/components/src/components/Molecules/Slideout/Slideout.js +5 -2
- package/dist/cjs/components/src/components/Molecules/Slideshow/Slideshow.js +38 -5
- package/dist/cjs/components/src/components/Molecules/Swatches/Swatches.js +1 -1
- package/dist/cjs/components/src/components/Molecules/VariantSelection/VariantSelection.js +7 -1
- package/dist/cjs/components/src/components/Organisms/AutocompleteLayout/AutocompleteLayout.js +8 -8
- package/dist/cjs/components/src/components/Organisms/Facet/Facet.js +1 -5
- package/dist/cjs/components/src/components/Organisms/QuickviewLayout/QuickviewLayout.js +612 -0
- package/dist/cjs/components/src/components/Organisms/QuickviewLayout/index.js +17 -0
- package/dist/cjs/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.js +3 -3
- package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +3 -3
- package/dist/cjs/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.js +2 -2
- package/dist/cjs/components/src/components/Templates/QuickviewModal/QuickviewModal.js +153 -0
- package/dist/cjs/components/src/components/Templates/QuickviewModal/index.js +17 -0
- package/dist/cjs/components/src/components/Templates/QuickviewSlideout/QuickviewSlideout.js +124 -0
- package/dist/cjs/components/src/components/Templates/QuickviewSlideout/index.js +17 -0
- package/dist/cjs/components/src/components/Templates/Recommendation/Recommendation.js +2 -1
- package/dist/cjs/components/src/components/Templates/RecommendationBundle/RecommendationBundle.js +2 -1
- package/dist/cjs/components/src/components/Templates/RecommendationGrid/RecommendationGrid.js +2 -1
- package/dist/cjs/components/src/hooks/useA11y.js +3 -1
- package/dist/cjs/components/src/hooks/useAcRenderedInput.js +1 -1
- package/dist/cjs/components/src/hooks/useClickOutside.js +6 -3
- package/dist/cjs/components/src/hooks/useTracking.js +14 -8
- package/dist/cjs/components/src/index.js +6 -0
- package/dist/cjs/components/src/providers/themeComponents.js +4 -0
- package/dist/cjs/components/src/setupTests.js +10 -0
- package/dist/cjs/components/src/utilities/createImpressionObserver.js +1 -1
- package/dist/cjs/components/src/utilities/index.js +1 -0
- package/dist/cjs/components/src/utilities/lazyRenderMinSize.js +10 -0
- package/dist/cjs/src/Instantiators/RecommendationInstantiator.js +2 -1
- package/dist/cjs/src/Snap.js +41 -0
- package/dist/cjs/src/Templates/SnapTemplates.js +51 -0
- package/dist/cjs/src/Templates/Stores/LibraryStore.js +77 -9
- package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.js +6 -1
- package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.js +2 -5
- package/dist/cjs/src/Templates/Stores/TemplateStore.js +26 -10
- package/dist/cjs/src/Templates/Stores/library/components/QuickviewModal.js +5 -0
- package/dist/cjs/src/Templates/Stores/library/components/QuickviewSlideout.js +5 -0
- package/dist/cjs/src/Templates/Stores/library/currencies/currencies.js +1433 -0
- package/dist/cjs/src/Templates/Stores/library/languages/ar.js +487 -0
- package/dist/cjs/src/Templates/Stores/library/languages/de.js +487 -0
- package/dist/cjs/src/Templates/Stores/library/languages/en.js +1 -0
- package/dist/cjs/src/Templates/Stores/library/languages/es.js +84 -41
- package/dist/cjs/src/Templates/Stores/library/languages/fr.js +85 -40
- package/dist/cjs/src/Templates/Stores/library/languages/hi.js +487 -0
- package/dist/cjs/src/Templates/Stores/library/languages/it.js +487 -0
- package/dist/cjs/src/Templates/Stores/library/languages/ja.js +487 -0
- package/dist/cjs/src/Templates/Stores/library/languages/ko.js +487 -0
- package/dist/cjs/src/Templates/Stores/library/languages/nl.js +487 -0
- package/dist/cjs/src/Templates/Stores/library/languages/pt.js +487 -0
- package/dist/cjs/src/Templates/Stores/library/languages/ru.js +487 -0
- package/dist/cjs/src/Templates/Stores/library/languages/tr.js +487 -0
- package/dist/cjs/src/Templates/Stores/library/languages/vi.js +487 -0
- package/dist/cjs/src/Templates/Stores/library/languages/zh.js +487 -0
- package/dist/cjs/src/Templates/index.js +3 -1
- package/dist/cjs/src/create/createAutocompleteController.js +1 -0
- package/dist/cjs/src/create/createRecommendationController.js +1 -0
- package/dist/cjs/src/create/createSearchController.js +1 -0
- package/dist/cjs/src/index.js +3 -1
- package/dist/esm/components/src/components/Atoms/Button/Button.d.ts +1 -1
- package/dist/esm/components/src/components/Atoms/Button/Button.d.ts.map +1 -1
- package/dist/esm/components/src/components/Atoms/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/components/src/components/Atoms/Dropdown/Dropdown.js +19 -11
- package/dist/esm/components/src/components/Atoms/Image/Image.d.ts +5 -0
- package/dist/esm/components/src/components/Atoms/Image/Image.d.ts.map +1 -1
- package/dist/esm/components/src/components/Atoms/Image/Image.js +10 -2
- package/dist/esm/components/src/components/Atoms/ProductDetail/ProductDetail.d.ts +18 -0
- package/dist/esm/components/src/components/Atoms/ProductDetail/ProductDetail.d.ts.map +1 -0
- package/dist/esm/components/src/components/Atoms/ProductDetail/ProductDetail.js +89 -0
- package/dist/esm/components/src/components/Atoms/ProductDetail/index.d.ts +3 -0
- package/dist/esm/components/src/components/Atoms/ProductDetail/index.d.ts.map +1 -0
- package/dist/esm/components/src/components/Atoms/ProductDetail/index.js +3 -0
- package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts +1 -1
- package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts.map +1 -1
- package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.js +13 -4
- package/dist/esm/components/src/components/Molecules/CalloutBadge/CalloutBadge.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/CalloutBadge/CalloutBadge.js +4 -1
- package/dist/esm/components/src/components/Molecules/Gallery/Gallery.d.ts +28 -0
- package/dist/esm/components/src/components/Molecules/Gallery/Gallery.d.ts.map +1 -0
- package/dist/esm/components/src/components/Molecules/Gallery/Gallery.js +292 -0
- package/dist/esm/components/src/components/Molecules/Gallery/index.d.ts +2 -0
- package/dist/esm/components/src/components/Molecules/Gallery/index.d.ts.map +1 -0
- package/dist/esm/components/src/components/Molecules/Gallery/index.js +1 -0
- package/dist/esm/components/src/components/Molecules/Modal/Modal.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/Modal/Modal.js +22 -3
- package/dist/esm/components/src/components/Molecules/OverlayBadge/OverlayBadge.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/OverlayBadge/OverlayBadge.js +1 -1
- package/dist/esm/components/src/components/Molecules/ProductDetailTable/ProductDetailTable.d.ts +14 -0
- package/dist/esm/components/src/components/Molecules/ProductDetailTable/ProductDetailTable.d.ts.map +1 -0
- package/dist/esm/components/src/components/Molecules/ProductDetailTable/ProductDetailTable.js +109 -0
- package/dist/esm/components/src/components/Molecules/ProductDetailTable/index.d.ts +2 -0
- package/dist/esm/components/src/components/Molecules/ProductDetailTable/index.d.ts.map +1 -0
- package/dist/esm/components/src/components/Molecules/ProductDetailTable/index.js +1 -0
- package/dist/esm/components/src/components/Molecules/QuantityPicker/QuantityPicker.d.ts +43 -0
- package/dist/esm/components/src/components/Molecules/QuantityPicker/QuantityPicker.d.ts.map +1 -0
- package/dist/esm/components/src/components/Molecules/QuantityPicker/QuantityPicker.js +130 -0
- package/dist/esm/components/src/components/Molecules/QuantityPicker/index.d.ts +2 -0
- package/dist/esm/components/src/components/Molecules/QuantityPicker/index.d.ts.map +1 -0
- package/dist/esm/components/src/components/Molecules/QuantityPicker/index.js +1 -0
- package/dist/esm/components/src/components/Molecules/Result/Result.d.ts +3 -0
- package/dist/esm/components/src/components/Molecules/Result/Result.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/Result/Result.js +43 -4
- package/dist/esm/components/src/components/Molecules/Slideout/Slideout.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/Slideout/Slideout.js +6 -3
- package/dist/esm/components/src/components/Molecules/Slideshow/Slideshow.d.ts +1 -0
- package/dist/esm/components/src/components/Molecules/Slideshow/Slideshow.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/Slideshow/Slideshow.js +38 -5
- package/dist/esm/components/src/components/Molecules/Swatches/Swatches.js +1 -1
- package/dist/esm/components/src/components/Molecules/VariantSelection/VariantSelection.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/VariantSelection/VariantSelection.js +7 -1
- package/dist/esm/components/src/components/Organisms/AutocompleteLayout/AutocompleteLayout.js +8 -8
- package/dist/esm/components/src/components/Organisms/Facet/Facet.d.ts.map +1 -1
- package/dist/esm/components/src/components/Organisms/Facet/Facet.js +1 -5
- package/dist/esm/components/src/components/Organisms/QuickviewLayout/QuickviewLayout.d.ts +53 -0
- package/dist/esm/components/src/components/Organisms/QuickviewLayout/QuickviewLayout.d.ts.map +1 -0
- package/dist/esm/components/src/components/Organisms/QuickviewLayout/QuickviewLayout.js +605 -0
- package/dist/esm/components/src/components/Organisms/QuickviewLayout/index.d.ts +2 -0
- package/dist/esm/components/src/components/Organisms/QuickviewLayout/index.d.ts.map +1 -0
- package/dist/esm/components/src/components/Organisms/QuickviewLayout/index.js +1 -0
- package/dist/esm/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.js +3 -3
- package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +3 -3
- package/dist/esm/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.js +2 -2
- package/dist/esm/components/src/components/Templates/QuickviewModal/QuickviewModal.d.ts +12 -0
- package/dist/esm/components/src/components/Templates/QuickviewModal/QuickviewModal.d.ts.map +1 -0
- package/dist/esm/components/src/components/Templates/QuickviewModal/QuickviewModal.js +147 -0
- package/dist/esm/components/src/components/Templates/QuickviewModal/index.d.ts +2 -0
- package/dist/esm/components/src/components/Templates/QuickviewModal/index.d.ts.map +1 -0
- package/dist/esm/components/src/components/Templates/QuickviewModal/index.js +1 -0
- package/dist/esm/components/src/components/Templates/QuickviewSlideout/QuickviewSlideout.d.ts +16 -0
- package/dist/esm/components/src/components/Templates/QuickviewSlideout/QuickviewSlideout.d.ts.map +1 -0
- package/dist/esm/components/src/components/Templates/QuickviewSlideout/QuickviewSlideout.js +118 -0
- package/dist/esm/components/src/components/Templates/QuickviewSlideout/index.d.ts +2 -0
- package/dist/esm/components/src/components/Templates/QuickviewSlideout/index.d.ts.map +1 -0
- package/dist/esm/components/src/components/Templates/QuickviewSlideout/index.js +1 -0
- package/dist/esm/components/src/components/Templates/Recommendation/Recommendation.d.ts.map +1 -1
- package/dist/esm/components/src/components/Templates/Recommendation/Recommendation.js +3 -2
- package/dist/esm/components/src/components/Templates/RecommendationBundle/RecommendationBundle.d.ts.map +1 -1
- package/dist/esm/components/src/components/Templates/RecommendationBundle/RecommendationBundle.js +3 -2
- package/dist/esm/components/src/components/Templates/RecommendationGrid/RecommendationGrid.d.ts.map +1 -1
- package/dist/esm/components/src/components/Templates/RecommendationGrid/RecommendationGrid.js +3 -2
- package/dist/esm/components/src/hooks/useA11y.d.ts.map +1 -1
- package/dist/esm/components/src/hooks/useA11y.js +3 -1
- package/dist/esm/components/src/hooks/useAcRenderedInput.js +1 -1
- package/dist/esm/components/src/hooks/useClickOutside.d.ts +1 -1
- package/dist/esm/components/src/hooks/useClickOutside.d.ts.map +1 -1
- package/dist/esm/components/src/hooks/useClickOutside.js +6 -3
- package/dist/esm/components/src/hooks/useTracking.d.ts +9 -3
- package/dist/esm/components/src/hooks/useTracking.d.ts.map +1 -1
- package/dist/esm/components/src/hooks/useTracking.js +14 -8
- package/dist/esm/components/src/index.d.ts +6 -0
- package/dist/esm/components/src/index.d.ts.map +1 -1
- package/dist/esm/components/src/index.js +6 -0
- package/dist/esm/components/src/providers/langComponents.d.ts +6 -0
- package/dist/esm/components/src/providers/langComponents.d.ts.map +1 -1
- package/dist/esm/components/src/providers/themeComponents.d.ts +104 -57
- package/dist/esm/components/src/providers/themeComponents.d.ts.map +1 -1
- package/dist/esm/components/src/providers/themeComponents.js +4 -0
- package/dist/esm/components/src/setupTests.js +10 -0
- package/dist/esm/components/src/utilities/createImpressionObserver.js +1 -1
- package/dist/esm/components/src/utilities/index.d.ts +1 -0
- package/dist/esm/components/src/utilities/index.d.ts.map +1 -1
- package/dist/esm/components/src/utilities/index.js +1 -0
- package/dist/esm/components/src/utilities/lazyRenderMinSize.d.ts +5 -0
- package/dist/esm/components/src/utilities/lazyRenderMinSize.d.ts.map +1 -0
- package/dist/esm/components/src/utilities/lazyRenderMinSize.js +7 -0
- package/dist/esm/src/Instantiators/RecommendationInstantiator.d.ts +4 -2
- package/dist/esm/src/Instantiators/RecommendationInstantiator.d.ts.map +1 -1
- package/dist/esm/src/Instantiators/RecommendationInstantiator.js +2 -1
- package/dist/esm/src/Snap.d.ts +7 -0
- package/dist/esm/src/Snap.d.ts.map +1 -1
- package/dist/esm/src/Snap.js +43 -2
- package/dist/esm/src/Templates/SnapTemplates.d.ts +25 -0
- package/dist/esm/src/Templates/SnapTemplates.d.ts.map +1 -1
- package/dist/esm/src/Templates/SnapTemplates.js +48 -0
- package/dist/esm/src/Templates/Stores/LibraryStore.d.ts +22 -2
- package/dist/esm/src/Templates/Stores/LibraryStore.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/LibraryStore.js +76 -8
- package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.js +6 -1
- package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.js +2 -5
- package/dist/esm/src/Templates/Stores/TemplateStore.d.ts +14 -6
- package/dist/esm/src/Templates/Stores/TemplateStore.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/TemplateStore.js +26 -10
- package/dist/esm/src/Templates/Stores/library/components/QuickviewModal.d.ts +2 -0
- package/dist/esm/src/Templates/Stores/library/components/QuickviewModal.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/components/QuickviewModal.js +1 -0
- package/dist/esm/src/Templates/Stores/library/components/QuickviewSlideout.d.ts +2 -0
- package/dist/esm/src/Templates/Stores/library/components/QuickviewSlideout.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/components/QuickviewSlideout.js +1 -0
- package/dist/esm/src/Templates/Stores/library/currencies/currencies.d.ts +1270 -0
- package/dist/esm/src/Templates/Stores/library/currencies/currencies.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/currencies/currencies.js +1430 -0
- package/dist/esm/src/Templates/Stores/library/languages/ar.d.ts +3 -0
- package/dist/esm/src/Templates/Stores/library/languages/ar.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/ar.js +484 -0
- package/dist/esm/src/Templates/Stores/library/languages/de.d.ts +3 -0
- package/dist/esm/src/Templates/Stores/library/languages/de.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/de.js +484 -0
- package/dist/esm/src/Templates/Stores/library/languages/en.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/library/languages/en.js +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/es.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/library/languages/es.js +84 -41
- package/dist/esm/src/Templates/Stores/library/languages/fr.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/library/languages/fr.js +85 -40
- package/dist/esm/src/Templates/Stores/library/languages/hi.d.ts +3 -0
- package/dist/esm/src/Templates/Stores/library/languages/hi.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/hi.js +484 -0
- package/dist/esm/src/Templates/Stores/library/languages/it.d.ts +3 -0
- package/dist/esm/src/Templates/Stores/library/languages/it.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/it.js +484 -0
- package/dist/esm/src/Templates/Stores/library/languages/ja.d.ts +3 -0
- package/dist/esm/src/Templates/Stores/library/languages/ja.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/ja.js +484 -0
- package/dist/esm/src/Templates/Stores/library/languages/ko.d.ts +3 -0
- package/dist/esm/src/Templates/Stores/library/languages/ko.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/ko.js +484 -0
- package/dist/esm/src/Templates/Stores/library/languages/nl.d.ts +3 -0
- package/dist/esm/src/Templates/Stores/library/languages/nl.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/nl.js +484 -0
- package/dist/esm/src/Templates/Stores/library/languages/pt.d.ts +3 -0
- package/dist/esm/src/Templates/Stores/library/languages/pt.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/pt.js +484 -0
- package/dist/esm/src/Templates/Stores/library/languages/ru.d.ts +3 -0
- package/dist/esm/src/Templates/Stores/library/languages/ru.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/ru.js +484 -0
- package/dist/esm/src/Templates/Stores/library/languages/tr.d.ts +3 -0
- package/dist/esm/src/Templates/Stores/library/languages/tr.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/tr.js +484 -0
- package/dist/esm/src/Templates/Stores/library/languages/vi.d.ts +3 -0
- package/dist/esm/src/Templates/Stores/library/languages/vi.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/vi.js +484 -0
- package/dist/esm/src/Templates/Stores/library/languages/zh.d.ts +3 -0
- package/dist/esm/src/Templates/Stores/library/languages/zh.d.ts.map +1 -0
- package/dist/esm/src/Templates/Stores/library/languages/zh.js +484 -0
- package/dist/esm/src/Templates/index.d.ts +1 -1
- package/dist/esm/src/Templates/index.d.ts.map +1 -1
- package/dist/esm/src/Templates/index.js +1 -1
- package/dist/esm/src/create/createAutocompleteController.js +1 -0
- package/dist/esm/src/create/createRecommendationController.js +1 -0
- package/dist/esm/src/create/createSearchController.js +1 -0
- package/dist/esm/src/index.d.ts +1 -1
- package/dist/esm/src/index.d.ts.map +1 -1
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/types.d.ts +2 -1
- package/dist/esm/src/types.d.ts.map +1 -1
- package/eslint/src/index.cjs +5 -0
- package/eslint/src/validate-config.cjs +473 -0
- package/package.json +16 -14
- package/dist/cjs/src/Templates/Stores/library/currencies/aud.js +0 -10
- package/dist/cjs/src/Templates/Stores/library/currencies/eur.js +0 -10
- package/dist/cjs/src/Templates/Stores/library/currencies/usd.js +0 -10
- package/dist/esm/src/Templates/Stores/library/currencies/aud.d.ts +0 -8
- package/dist/esm/src/Templates/Stores/library/currencies/aud.d.ts.map +0 -1
- package/dist/esm/src/Templates/Stores/library/currencies/aud.js +0 -7
- package/dist/esm/src/Templates/Stores/library/currencies/eur.d.ts +0 -8
- package/dist/esm/src/Templates/Stores/library/currencies/eur.d.ts.map +0 -1
- package/dist/esm/src/Templates/Stores/library/currencies/eur.js +0 -7
- package/dist/esm/src/Templates/Stores/library/currencies/usd.d.ts +0 -8
- package/dist/esm/src/Templates/Stores/library/currencies/usd.d.ts.map +0 -1
- package/dist/esm/src/Templates/Stores/library/currencies/usd.js +0 -7
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import { observer } from 'mobx-react-lite';
|
|
5
|
+
import { isObservableArray } from 'mobx';
|
|
6
|
+
import { useTheme, CacheProvider, useTreePath } from '../../../providers';
|
|
7
|
+
import { defined, mergeProps, mergeStyles } from '../../../utilities';
|
|
8
|
+
import { useCustomComponentOverride } from '../../../hooks';
|
|
9
|
+
import { ProductDetail } from '../../Atoms/ProductDetail';
|
|
10
|
+
import { getProductFieldValue, renderDetailValue } from '../../Atoms/ProductDetail/ProductDetail';
|
|
11
|
+
import { Price } from '../../Atoms/Price';
|
|
12
|
+
import { Image } from '../../Atoms/Image';
|
|
13
|
+
import { Rating } from '../Rating';
|
|
14
|
+
const defaultStyles = () => {
|
|
15
|
+
return css({
|
|
16
|
+
width: '100%',
|
|
17
|
+
borderCollapse: 'collapse',
|
|
18
|
+
fontSize: '0.9em',
|
|
19
|
+
'& tr': {
|
|
20
|
+
borderBottom: '1px solid #eee',
|
|
21
|
+
},
|
|
22
|
+
'& tr:last-of-type': {
|
|
23
|
+
borderBottom: 'none',
|
|
24
|
+
},
|
|
25
|
+
'& th, & td': {
|
|
26
|
+
padding: '10px 0',
|
|
27
|
+
textAlign: 'left',
|
|
28
|
+
verticalAlign: 'top',
|
|
29
|
+
},
|
|
30
|
+
'& th': {
|
|
31
|
+
width: '40%',
|
|
32
|
+
paddingRight: '16px',
|
|
33
|
+
fontWeight: 500,
|
|
34
|
+
color: '#666',
|
|
35
|
+
textTransform: 'uppercase',
|
|
36
|
+
fontSize: '0.85em',
|
|
37
|
+
letterSpacing: '0.02em',
|
|
38
|
+
},
|
|
39
|
+
'& td': {
|
|
40
|
+
color: '#1a1a1a',
|
|
41
|
+
// Typed values render components whose defaults center them (Rating flex-centers its
|
|
42
|
+
// stars, Image stretches and letterboxes via objectFit) — left-align both so every
|
|
43
|
+
// display type lines up with the plain text values.
|
|
44
|
+
'& .ss__rating': {
|
|
45
|
+
justifyContent: 'flex-start',
|
|
46
|
+
},
|
|
47
|
+
'& .ss__image': {
|
|
48
|
+
alignItems: 'flex-start',
|
|
49
|
+
// Cap images at a row-scale thumbnail (width stays auto, preserving aspect ratio)
|
|
50
|
+
// so a full-size product image can't dwarf the table.
|
|
51
|
+
'& img': {
|
|
52
|
+
maxHeight: '100px',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
export const ProductDetailTable = observer((properties) => {
|
|
59
|
+
const globalTheme = useTheme();
|
|
60
|
+
const globalTreePath = useTreePath();
|
|
61
|
+
const defaultProps = {
|
|
62
|
+
treePath: globalTreePath,
|
|
63
|
+
};
|
|
64
|
+
const props = mergeProps('productDetailTable', globalTheme, defaultProps, properties);
|
|
65
|
+
const { result, displayFields, disableStyles, className, internalClassName, treePath } = props;
|
|
66
|
+
const { overrideElement, shouldRenderDefault } = useCustomComponentOverride('productDetailTable', props);
|
|
67
|
+
if (!shouldRenderDefault) {
|
|
68
|
+
return overrideElement;
|
|
69
|
+
}
|
|
70
|
+
const styling = mergeStyles(props, defaultStyles);
|
|
71
|
+
// Render only the configured fields that resolve to a non-empty value (preserves the opt-in
|
|
72
|
+
// behaviour: with no displayFields, nothing renders).
|
|
73
|
+
const displayedFields = (displayFields || []).filter((detail) => renderDetailValue(getProductFieldValue(result, detail.field)) !== '');
|
|
74
|
+
if (displayedFields.length === 0)
|
|
75
|
+
return null;
|
|
76
|
+
const renderValue = (detail) => {
|
|
77
|
+
const rawValue = getProductFieldValue(result, detail.field);
|
|
78
|
+
const componentProps = { theme: props.theme, treePath, ...defined({ disableStyles }) };
|
|
79
|
+
switch (detail.type) {
|
|
80
|
+
case 'price': {
|
|
81
|
+
const value = Number(rawValue);
|
|
82
|
+
if (!isNaN(value)) {
|
|
83
|
+
return _jsx(Price, { value: value, ...componentProps });
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
case 'rating': {
|
|
88
|
+
const value = Number(rawValue);
|
|
89
|
+
if (!isNaN(value)) {
|
|
90
|
+
return _jsx(Rating, { value: value, ...componentProps });
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
case 'image': {
|
|
95
|
+
// An image field may resolve to an array of URLs — display the first.
|
|
96
|
+
const src = Array.isArray(rawValue) || isObservableArray(rawValue) ? Array.from(rawValue)[0] : rawValue;
|
|
97
|
+
if (typeof src === 'string' && src) {
|
|
98
|
+
return _jsx(Image, { src: src, alt: detail.label || detail.field, ...componentProps });
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
case 'html':
|
|
103
|
+
return _jsx(ProductDetail, { result: result, field: detail.field, html: true, ...componentProps });
|
|
104
|
+
}
|
|
105
|
+
// 'text' (the default) — and the fallback when a typed value doesn't fit its type.
|
|
106
|
+
return _jsx(ProductDetail, { result: result, field: detail.field, ...componentProps });
|
|
107
|
+
};
|
|
108
|
+
return (_jsx(CacheProvider, { children: _jsx("table", { ...styling, className: classnames('ss__product-detail-table', className, internalClassName), children: _jsx("tbody", { children: displayedFields.map((detail, index) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: detail.label ?? detail.field }), _jsx("td", { children: renderValue(detail) })] }, `${detail.field}-${index}`))) }) }) }));
|
|
109
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/ProductDetailTable/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ProductDetailTable';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { ComponentProps } from '../../../types';
|
|
3
|
+
import { Lang } from '../../../hooks';
|
|
4
|
+
export declare const QuantityPicker: ((properties: QuantityPickerProps) => import("@emotion/react/jsx-runtime").JSX.Element | h.JSX.Element | null) & {
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
7
|
+
type QuantityPickerChangeEvent = React.MouseEvent<HTMLElement, MouseEvent> | React.FocusEvent<HTMLInputElement>;
|
|
8
|
+
export type QuantityPickerProps = {
|
|
9
|
+
lang?: Partial<QuantityPickerLang>;
|
|
10
|
+
value?: number;
|
|
11
|
+
startValue?: number;
|
|
12
|
+
} & QuantityPickerTemplatesLegalProps & ComponentProps<QuantityPickerProps>;
|
|
13
|
+
export type QuantityPickerTemplatesLegalProps = {
|
|
14
|
+
min?: number;
|
|
15
|
+
max?: number;
|
|
16
|
+
step?: number;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
hideButtons?: boolean;
|
|
19
|
+
label?: string;
|
|
20
|
+
onChange?: (e: QuantityPickerChangeEvent, value: number) => void;
|
|
21
|
+
};
|
|
22
|
+
export interface QuantityPickerLang {
|
|
23
|
+
quantityInput: Lang<{
|
|
24
|
+
quantity: number;
|
|
25
|
+
min: number;
|
|
26
|
+
max?: number;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
}>;
|
|
29
|
+
decrementButton: Lang<{
|
|
30
|
+
quantity: number;
|
|
31
|
+
min: number;
|
|
32
|
+
max?: number;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
incrementButton: Lang<{
|
|
36
|
+
quantity: number;
|
|
37
|
+
min: number;
|
|
38
|
+
max?: number;
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=QuantityPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuantityPicker.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/QuantityPicker/QuantityPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAQ3B,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAG7D,OAAO,EAAE,IAAI,EAAuC,MAAM,gBAAgB,CAAC;AA6B3E,eAAO,MAAM,cAAc,gBAAyB,mBAAmB;;CAwLrE,CAAC;AAMH,KAAK,yBAAyB,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;AAEhH,MAAM,MAAM,mBAAmB,GAAG;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,iCAAiC,GACpC,cAAc,CAAC,mBAAmB,CAAC,CAAC;AAErC,MAAM,MAAM,iCAAiC,GAAG;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACjE,CAAC;AAEF,MAAM,WAAW,kBAAkB;IAClC,aAAa,EAAE,IAAI,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;IACH,eAAe,EAAE,IAAI,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;IACH,eAAe,EAAE,IAAI,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;CACH"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useState } from 'preact/hooks';
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import { observer } from 'mobx-react-lite';
|
|
6
|
+
import deepmerge from 'deepmerge';
|
|
7
|
+
import { defined, mergeProps, mergeStyles } from '../../../utilities';
|
|
8
|
+
import { useTheme, CacheProvider, useTreePath } from '../../../providers';
|
|
9
|
+
import { useLang, useCustomComponentOverride } from '../../../hooks';
|
|
10
|
+
import { Button } from '../../Atoms/Button';
|
|
11
|
+
const defaultStyles = () => {
|
|
12
|
+
return css({
|
|
13
|
+
display: 'inline-flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
gap: '5px',
|
|
16
|
+
'&.ss__quantity-picker--disabled': {
|
|
17
|
+
opacity: 0.7,
|
|
18
|
+
},
|
|
19
|
+
'& .ss__quantity-picker__label-wrapper': {
|
|
20
|
+
display: 'inline-flex',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
},
|
|
23
|
+
'& .ss__quantity-picker__controls-wrapper': {
|
|
24
|
+
display: 'inline-flex',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
gap: '5px',
|
|
27
|
+
},
|
|
28
|
+
'& .ss__quantity-picker__input': {
|
|
29
|
+
width: '60px',
|
|
30
|
+
textAlign: 'center',
|
|
31
|
+
padding: '5px',
|
|
32
|
+
boxSizing: 'border-box',
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export const QuantityPicker = observer((properties) => {
|
|
37
|
+
const globalTheme = useTheme();
|
|
38
|
+
const globalTreePath = useTreePath();
|
|
39
|
+
const defaultProps = {
|
|
40
|
+
min: 1,
|
|
41
|
+
step: 1,
|
|
42
|
+
treePath: globalTreePath,
|
|
43
|
+
};
|
|
44
|
+
const props = mergeProps('quantityPicker', globalTheme, defaultProps, properties);
|
|
45
|
+
const { value, startValue, min, max, step, disabled, hideButtons, label, onChange, disableStyles, className, internalClassName, theme: ______, treePath, lang, style: _, styleScript: __, themeStyleScript: ___, name: ____, ...additionalProps } = props;
|
|
46
|
+
// whole numbers only, never negative, within min/max
|
|
47
|
+
const minimum = Math.max(0, Math.trunc(min));
|
|
48
|
+
const clamp = (num) => {
|
|
49
|
+
let clamped = Math.trunc(num);
|
|
50
|
+
if (isNaN(clamped)) {
|
|
51
|
+
clamped = minimum;
|
|
52
|
+
}
|
|
53
|
+
clamped = Math.max(minimum, clamped);
|
|
54
|
+
if (typeof max == 'number') {
|
|
55
|
+
clamped = Math.min(Math.trunc(max), clamped);
|
|
56
|
+
}
|
|
57
|
+
return clamped;
|
|
58
|
+
};
|
|
59
|
+
// useState is called unconditionally (rules of hooks): a `value` prop that transitions between
|
|
60
|
+
// undefined and defined across renders must not shift hook order. In controlled mode the
|
|
61
|
+
// internal state is simply ignored and the quantity derives from the prop.
|
|
62
|
+
const [internalQuantity, setQuantityState] = useState(clamp(startValue ?? minimum));
|
|
63
|
+
const stateful = value === undefined;
|
|
64
|
+
const quantity = stateful ? internalQuantity : clamp(value);
|
|
65
|
+
// raw input text while typing - committed (clamped) on blur
|
|
66
|
+
const [editingValue, setEditingValue] = useState(undefined);
|
|
67
|
+
const { overrideElement, shouldRenderDefault } = useCustomComponentOverride('quantityPicker', props);
|
|
68
|
+
if (!shouldRenderDefault) {
|
|
69
|
+
return overrideElement;
|
|
70
|
+
}
|
|
71
|
+
const commit = (e, newValue) => {
|
|
72
|
+
if (disabled) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const clamped = clamp(newValue);
|
|
76
|
+
if (stateful) {
|
|
77
|
+
setQuantityState(clamped);
|
|
78
|
+
}
|
|
79
|
+
if (clamped !== quantity) {
|
|
80
|
+
onChange && onChange(e, clamped);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const styling = mergeStyles(props, defaultStyles);
|
|
84
|
+
//initialize lang
|
|
85
|
+
const defaultLang = {
|
|
86
|
+
quantityInput: {
|
|
87
|
+
attributes: {
|
|
88
|
+
'aria-label': 'quantity',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
decrementButton: {
|
|
92
|
+
attributes: {
|
|
93
|
+
'aria-label': 'decrease quantity',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
incrementButton: {
|
|
97
|
+
attributes: {
|
|
98
|
+
'aria-label': 'increase quantity',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
//deep merge with props.lang
|
|
103
|
+
const _lang = deepmerge(defaultLang, lang || {});
|
|
104
|
+
const mergedLang = useLang(_lang, {
|
|
105
|
+
quantity,
|
|
106
|
+
min: minimum,
|
|
107
|
+
max,
|
|
108
|
+
disabled,
|
|
109
|
+
}, { activeBreakpoint: globalTheme?.activeBreakpoint });
|
|
110
|
+
const subProps = {
|
|
111
|
+
button: {
|
|
112
|
+
// default props
|
|
113
|
+
internalClassName: 'ss__quantity-picker__button',
|
|
114
|
+
// inherited props
|
|
115
|
+
...defined({
|
|
116
|
+
disableStyles,
|
|
117
|
+
}),
|
|
118
|
+
// component theme overrides
|
|
119
|
+
theme: props.theme,
|
|
120
|
+
treePath,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
return (_jsx(CacheProvider, { children: _jsxs("div", { ...styling, className: classnames('ss__quantity-picker', { 'ss__quantity-picker--disabled': disabled }, className, internalClassName), ...additionalProps, children: [label && (_jsx("div", { className: "ss__quantity-picker__label-wrapper", children: _jsx("span", { className: "ss__quantity-picker__label", children: label }) })), _jsxs("div", { className: "ss__quantity-picker__controls-wrapper", children: [!hideButtons && (_jsx(Button, { ...subProps.button, name: "decrement", internalClassName: classnames(subProps.button.internalClassName, 'ss__quantity-picker__button--decrement'), disabled: disabled || quantity <= minimum, onClick: (e) => commit(e, quantity - step), icon: 'minus-thin', ...mergedLang.decrementButton?.attributes })), _jsx("input", { className: "ss__quantity-picker__input", type: "number", inputMode: "numeric", min: minimum, max: max, step: step, value: editingValue ?? quantity, disabled: disabled, onInput: (e) => setEditingValue(e.target.value), onBlur: (e) => {
|
|
124
|
+
if (editingValue !== undefined) {
|
|
125
|
+
const parsed = parseFloat(editingValue);
|
|
126
|
+
commit(e, isNaN(parsed) ? quantity : parsed);
|
|
127
|
+
setEditingValue(undefined);
|
|
128
|
+
}
|
|
129
|
+
}, ...mergedLang.quantityInput?.all }), !hideButtons && (_jsx(Button, { ...subProps.button, name: "increment", internalClassName: classnames(subProps.button.internalClassName, 'ss__quantity-picker__button--increment'), disabled: disabled || (typeof max == 'number' && quantity >= max), onClick: (e) => commit(e, quantity + step), icon: 'plus-thin', ...mergedLang.incrementButton?.attributes }))] })] }) }));
|
|
130
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/QuantityPicker/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QuantityPicker';
|
|
@@ -25,8 +25,10 @@ export type ResultTemplatesLegalProps = {
|
|
|
25
25
|
hideRating?: boolean;
|
|
26
26
|
hideVariantSelections?: boolean;
|
|
27
27
|
hideAddToCartButton?: boolean;
|
|
28
|
+
hideQuickviewButton?: boolean;
|
|
28
29
|
addToCartButtonText?: string;
|
|
29
30
|
onAddToCartClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, result: Product) => void;
|
|
31
|
+
onQuickviewClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, result: Product) => void;
|
|
30
32
|
addToCartButtonSuccessText?: string;
|
|
31
33
|
addToCartButtonSuccessTimeout?: number;
|
|
32
34
|
detailSlot?: JSX.Element | JSX.Element[];
|
|
@@ -38,6 +40,7 @@ export type ResultTemplatesLegalProps = {
|
|
|
38
40
|
export interface ResultLang {
|
|
39
41
|
addToCartButtonText: Lang<ResultPropData>;
|
|
40
42
|
addToCartButtonSuccessText: Lang<ResultPropData>;
|
|
43
|
+
quickviewButtonText: Lang<ResultPropData>;
|
|
41
44
|
}
|
|
42
45
|
interface ResultPropData {
|
|
43
46
|
result: Product;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Result.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/Result/Result.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAY,MAAM,cAAc,CAAC;AAUpD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAe,MAAM,gBAAgB,CAAC;AAG5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AACzH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAI9D,OAAO,EAAE,IAAI,EAAuC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Result.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/Result/Result.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAY,MAAM,cAAc,CAAC;AAUpD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAe,MAAM,gBAAgB,CAAC;AAG5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AACzH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAI9D,OAAO,EAAE,IAAI,EAAuC,MAAM,gBAAgB,CAAC;AAkE3E,eAAO,MAAM,MAAM,gBAAyB,WAAW;;CA0SrD,CAAC;AAYH,MAAM,WAAW,kBAAkB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,gBAAgB,GAAG,sBAAsB,GAAG,wBAAwB,CAAC;IAClF,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3B,WAAW,CAAC,EAAE,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC7C,GAAG,yBAAyB,GAC5B,cAAc,CAAC,WAAW,CAAC,CAAC;AAE7B,MAAM,MAAM,yBAAyB,GAAG;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3F,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3F,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,OAAO,aAAa,GAAG,aAAa,CAAC;IACpD,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;CAClE,CAAC;AAEF,MAAM,WAAW,UAAU;IAC1B,mBAAmB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1C,0BAA0B,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACjD,mBAAmB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;CAC1C;AAED,UAAU,cAAc;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,gBAAgB,GAAG,sBAAsB,GAAG,wBAAwB,CAAC;CAClF;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC"}
|
|
@@ -45,6 +45,16 @@ const defaultStyles = () => {
|
|
|
45
45
|
background: 'rgba(255, 255, 255, 0.5)',
|
|
46
46
|
padding: '10px',
|
|
47
47
|
},
|
|
48
|
+
'& .ss__result__quickview': {
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
bottom: '10px',
|
|
51
|
+
right: '10px',
|
|
52
|
+
display: 'flex',
|
|
53
|
+
background: 'transparent',
|
|
54
|
+
border: 0,
|
|
55
|
+
padding: '5px',
|
|
56
|
+
cursor: 'pointer',
|
|
57
|
+
},
|
|
48
58
|
},
|
|
49
59
|
'& .ss__result__details': {
|
|
50
60
|
padding: '10px',
|
|
@@ -75,9 +85,10 @@ export const Result = observer((properties) => {
|
|
|
75
85
|
addToCartButtonSuccessTimeout: 2000,
|
|
76
86
|
hideAddToCartButton: true,
|
|
77
87
|
hideRating: true,
|
|
88
|
+
hideQuickviewButton: true,
|
|
78
89
|
};
|
|
79
90
|
const props = mergeProps('result', globalTheme, defaultProps, properties);
|
|
80
|
-
const { result, hideBadge, hideTitle, hidePricing, hideImage, detailSlot, fallback, disableStyles, className, internalClassName, layout, onClick, controller, hideVariantSelections, hideAddToCartButton, onAddToCartClick, addToCartButtonText, addToCartButtonSuccessText, addToCartButtonSuccessTimeout, hideRating, trackingRef, treePath, } = props;
|
|
91
|
+
const { result, hideBadge, hideTitle, hidePricing, hideImage, detailSlot, fallback, disableStyles, className, internalClassName, layout, onClick, controller, hideVariantSelections, hideAddToCartButton, onAddToCartClick, addToCartButtonText, addToCartButtonSuccessText, addToCartButtonSuccessTimeout, hideRating, hideQuickviewButton, onQuickviewClick, trackingRef, treePath, } = props;
|
|
81
92
|
const { overrideElement, shouldRenderDefault } = useCustomComponentOverride('result', {
|
|
82
93
|
...props,
|
|
83
94
|
customComponent: props.customComponent && props.customComponent !== 'Result' ? props.customComponent : undefined,
|
|
@@ -160,6 +171,29 @@ export const Result = observer((properties) => {
|
|
|
160
171
|
theme: props.theme,
|
|
161
172
|
treePath,
|
|
162
173
|
},
|
|
174
|
+
quickviewButton: {
|
|
175
|
+
// default props
|
|
176
|
+
name: 'quickview',
|
|
177
|
+
internalClassName: 'ss__result__quickview',
|
|
178
|
+
icon: {
|
|
179
|
+
internalClassName: 'ss__result__quickview__icon',
|
|
180
|
+
icon: 'eye',
|
|
181
|
+
size: '20px',
|
|
182
|
+
},
|
|
183
|
+
onClick: (e) => {
|
|
184
|
+
if (onQuickviewClick) {
|
|
185
|
+
onQuickviewClick(e, result);
|
|
186
|
+
}
|
|
187
|
+
controller?.quickview(result);
|
|
188
|
+
},
|
|
189
|
+
// inherited props
|
|
190
|
+
...defined({
|
|
191
|
+
disableStyles,
|
|
192
|
+
}),
|
|
193
|
+
// component theme overrides
|
|
194
|
+
theme: props.theme,
|
|
195
|
+
treePath,
|
|
196
|
+
},
|
|
163
197
|
button: {
|
|
164
198
|
// default props
|
|
165
199
|
internalClassName: 'ss__result__button--addToCart',
|
|
@@ -190,6 +224,11 @@ export const Result = observer((properties) => {
|
|
|
190
224
|
addToCartButtonText: {
|
|
191
225
|
value: addedToCart ? addToCartButtonSuccessText : addToCartButtonText,
|
|
192
226
|
},
|
|
227
|
+
quickviewButtonText: {
|
|
228
|
+
attributes: {
|
|
229
|
+
'aria-label': 'Quick View',
|
|
230
|
+
},
|
|
231
|
+
},
|
|
193
232
|
};
|
|
194
233
|
//deep merge with props.lang
|
|
195
234
|
const lang = deepmerge(defaultLang, props.lang || {});
|
|
@@ -199,9 +238,9 @@ export const Result = observer((properties) => {
|
|
|
199
238
|
}, { activeBreakpoint: globalTheme?.activeBreakpoint });
|
|
200
239
|
const isOnSale = Boolean(core?.msrp && core?.price && core?.price < core?.msrp);
|
|
201
240
|
const renderPrices = controller?.store?.config?.asyncState?.product?.price ? result.state.priceFetched : true;
|
|
202
|
-
return core ? (_jsx(CacheProvider, { children: _jsxs("article", { ...styling, className: classnames('ss__result', `ss__result--${layout}`, { 'ss__result--sale': isOnSale }, className, internalClassName), ref: trackingRef, children: [!hideImage && (
|
|
203
|
-
|
|
204
|
-
|
|
241
|
+
return core ? (_jsx(CacheProvider, { children: _jsxs("article", { ...styling, className: classnames('ss__result', `ss__result--${layout}`, { 'ss__result--sale': isOnSale }, className, internalClassName), ref: trackingRef, children: [!hideImage && (_jsxs("div", { className: "ss__result__image-wrapper", children: [_jsx("a", { href: core.url, onClick: (e) => {
|
|
242
|
+
onClick && onClick(e);
|
|
243
|
+
}, children: !hideBadge ? (_jsx(OverlayBadge, { ...subProps.overlayBadge, controller: controller, children: _jsx(Image, { ...subProps.image }) })) : (_jsx(Image, { ...subProps.image })) }), !hideQuickviewButton && controller?.quickviewManager && (_jsx(Button, { ...subProps.quickviewButton, ...mergedLang.quickviewButtonText.attributes }))] })), _jsxs("div", { className: "ss__result__details", children: [!hideBadge && (_jsx(CalloutBadge, { ...subProps.calloutBadge, controller: controller })), !hideTitle && (_jsx("div", { className: "ss__result__details__title", children: _jsx("a", { href: core.url, onClick: (e) => {
|
|
205
244
|
onClick && onClick(e);
|
|
206
245
|
}, dangerouslySetInnerHTML: {
|
|
207
246
|
__html: displayName || '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slideout.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/Slideout/Slideout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAS9C,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AA+B7D,eAAO,MAAM,QAAQ,gBAAyB,aAAa;;
|
|
1
|
+
{"version":3,"file":"Slideout.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/Slideout/Slideout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAS9C,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AA+B7D,eAAO,MAAM,QAAQ,gBAAyB,aAAa;;CAkIzD,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,2BAA2B,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AACxF,MAAM,MAAM,2BAA2B,GAAG;IACzC,aAAa,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IACrC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from 'preact/hooks';
|
|
2
|
+
import { useState, useEffect, useLayoutEffect } from 'preact/hooks';
|
|
3
3
|
import { observer } from 'mobx-react-lite';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import classnames from 'classnames';
|
|
@@ -86,8 +86,11 @@ export const Slideout = observer((properties) => {
|
|
|
86
86
|
document.body.style.overflow = newActive ? 'hidden' : '';
|
|
87
87
|
onChange && onChange(newActive);
|
|
88
88
|
};
|
|
89
|
-
//
|
|
90
|
-
|
|
89
|
+
// Sync internal state when the active prop changes from the parent component. This is a
|
|
90
|
+
// layout effect so the content commit is scheduled before consumers' passive effects run —
|
|
91
|
+
// a plain effect would mount the content one tick later, after a parent that opened the
|
|
92
|
+
// slideout has already tried (and failed) to move focus into it.
|
|
93
|
+
useLayoutEffect(() => {
|
|
91
94
|
setRenderContent(Boolean(active));
|
|
92
95
|
setActive(Boolean(active));
|
|
93
96
|
}, [active]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slideshow.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/Slideshow/Slideshow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAM3B,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAI7D,OAAO,EAAE,IAAI,EAAuC,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"Slideshow.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/Slideshow/Slideshow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAM3B,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAI7D,OAAO,EAAE,IAAI,EAAuC,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AA+JxD,eAAO,MAAM,SAAS,gBAAyB,cAAc;;CAisB3D,CAAC;AAEH,MAAM,WAAW,aAAa;IAC7B,WAAW,EAAE,IAAI,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC;QACnB,cAAc,EAAE,OAAO,CAAC;QACxB,cAAc,EAAE,OAAO,CAAC;KACxB,CAAC,CAAC;IACH,gBAAgB,EAAE,cAAc,CAAC;QAChC,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,UAAU,EAAE,IAAI,CAAC;QAChB,SAAS,EAAE,OAAO,CAAC;QACnB,cAAc,EAAE,OAAO,CAAC;QACxB,cAAc,EAAE,OAAO,CAAC;KACxB,CAAC,CAAC;IACH,UAAU,EAAE,IAAI,CAAC;QAChB,SAAS,EAAE,OAAO,CAAC;QACnB,cAAc,EAAE,OAAO,CAAC;QACxB,cAAc,EAAE,OAAO,CAAC;KACxB,CAAC,CAAC;IACH,KAAK,EAAE,cAAc,CAAC;QACrB,eAAe,EAAE,OAAO,CAAC;QACzB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;IACH,cAAc,EAAE,IAAI,CAAC;QACpB,aAAa,EAAE,OAAO,CAAC;KACvB,CAAC,CAAC;CACH;AAED,MAAM,WAAW,cAAc;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAC9B,GAAG,4BAA4B,GAC/B,cAAc,CAAC,cAAc,CAAC,CAAC;AAEhC,MAAM,MAAM,4BAA4B,GAAG;IAC1C,MAAM,EAAE,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
|
|
@@ -9,6 +9,8 @@ import { Image } from '../../Atoms/Image';
|
|
|
9
9
|
import { Button } from '../../Atoms/Button';
|
|
10
10
|
import { useLang, useCustomComponentOverride } from '../../../hooks';
|
|
11
11
|
import deepmerge from 'deepmerge';
|
|
12
|
+
// Pointer travel (px) past which a press is treated as a drag rather than a click.
|
|
13
|
+
const DRAG_CLICK_THRESHOLD = 5;
|
|
12
14
|
const defaultStyles = ({ theme, slidesToShow = 1, slideWidth, gap = 16, overlayNavigation = false, showNavigation }) => {
|
|
13
15
|
return css({
|
|
14
16
|
position: 'relative',
|
|
@@ -155,13 +157,14 @@ export const Slideshow = observer((properties) => {
|
|
|
155
157
|
centerInsufficientSlides: true,
|
|
156
158
|
slidesToShow: properties.slideWidth ? undefined : 4,
|
|
157
159
|
slidesToMove: 1,
|
|
160
|
+
startIndex: 0,
|
|
158
161
|
gap: 10,
|
|
159
162
|
ariaLabel: 'slideshow',
|
|
160
163
|
touchDragging: true,
|
|
161
164
|
dragThreshold: 50,
|
|
162
165
|
};
|
|
163
166
|
const props = mergeProps('slideshow', globalTheme, defaultProps, properties);
|
|
164
|
-
const { className, slides, fallbackImage, autoPlay, autoPlayInterval, showNavigation, showPagination, loop, alwaysShowNavigation, slidesToShow, slideImageAlt, centerInsufficientSlides, ariaLabel, ariaLabelledBy, disableStyles, slideWidth, gap, treePath, overlayNavigation, dragThreshold, } = props;
|
|
167
|
+
const { className, slides, fallbackImage, autoPlay, autoPlayInterval, showNavigation, showPagination, loop, alwaysShowNavigation, slidesToShow, slideImageAlt, centerInsufficientSlides, ariaLabel, ariaLabelledBy, disableStyles, slideWidth, startIndex, gap, treePath, overlayNavigation, dragThreshold, } = props;
|
|
165
168
|
const { overrideElement, shouldRenderDefault } = useCustomComponentOverride('slideshow', props);
|
|
166
169
|
if (!shouldRenderDefault) {
|
|
167
170
|
return overrideElement;
|
|
@@ -236,12 +239,17 @@ export const Slideshow = observer((properties) => {
|
|
|
236
239
|
if (!slidesToMove) {
|
|
237
240
|
slidesToMove = 1;
|
|
238
241
|
}
|
|
239
|
-
const [currentIndex, setCurrentIndex] = useState(0);
|
|
242
|
+
const [currentIndex, setCurrentIndex] = useState(startIndex ?? 0);
|
|
240
243
|
const [isPlaying, setIsPlaying] = useState(autoPlay);
|
|
241
244
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
242
245
|
const intervalRef = useRef(null);
|
|
243
246
|
const slideshowRef = useRef(null);
|
|
244
247
|
const trackRef = useRef(null);
|
|
248
|
+
// Tracks whether the pointer moved during the current press. The browser fires a `click`
|
|
249
|
+
// after a drag's `mouseup`, by which point `isDragging` state has already been reset — so a
|
|
250
|
+
// swipe would otherwise be treated as a click (e.g. opening a lightbox). This synchronous ref
|
|
251
|
+
// lets `handleSlideClick` suppress that trailing click.
|
|
252
|
+
const hasDraggedRef = useRef(false);
|
|
245
253
|
// Track container width for slideWidth-based visible slide calculation
|
|
246
254
|
useEffect(() => {
|
|
247
255
|
const container = trackRef.current?.parentElement;
|
|
@@ -294,6 +302,23 @@ export const Slideshow = observer((properties) => {
|
|
|
294
302
|
const computedSlidesToShow = slideWidth && containerWidth > 0 ? Math.max(1, Math.floor(containerWidth / (slideWidth + (gap ?? 0)))) : slidesToShow ?? 4;
|
|
295
303
|
const visibleSlides = Math.min(computedSlidesToShow, totalSlides);
|
|
296
304
|
const maxIndex = Math.max(0, totalSlides - visibleSlides);
|
|
305
|
+
// Navigate to startIndex when it changes (e.g. a consumer syncing the active slide to external
|
|
306
|
+
// state), clamped to the valid range. Updates the index in place rather than remounting.
|
|
307
|
+
// maxIndex must be a dependency: in slideWidth mode it is derived from the slidesToShow
|
|
308
|
+
// fallback until the container is measured (after the first render), so the mount-time clamp
|
|
309
|
+
// can land short and needs to re-run when the real value arrives. But once the requested
|
|
310
|
+
// startIndex has been satisfied the effect must go inert, or every resize that shifts
|
|
311
|
+
// maxIndex would yank the shopper back to startIndex mid-navigation.
|
|
312
|
+
const appliedStartIndexRef = useRef(undefined);
|
|
313
|
+
useEffect(() => {
|
|
314
|
+
const target = Math.max(0, startIndex ?? 0);
|
|
315
|
+
if (appliedStartIndexRef.current === target)
|
|
316
|
+
return;
|
|
317
|
+
setCurrentIndex(Math.min(target, maxIndex));
|
|
318
|
+
if (target <= maxIndex) {
|
|
319
|
+
appliedStartIndexRef.current = target;
|
|
320
|
+
}
|
|
321
|
+
}, [startIndex, maxIndex]);
|
|
297
322
|
// Calculate slide groups for pagination
|
|
298
323
|
const slideGroups = [];
|
|
299
324
|
for (let i = 0; i <= maxIndex; i += slidesToMove) {
|
|
@@ -339,6 +364,7 @@ export const Slideshow = observer((properties) => {
|
|
|
339
364
|
const handleDragStart = (clientX) => {
|
|
340
365
|
if (!touchDragging)
|
|
341
366
|
return;
|
|
367
|
+
hasDraggedRef.current = false;
|
|
342
368
|
setIsPlaying(false);
|
|
343
369
|
setIsDragging(true);
|
|
344
370
|
setStartX(clientX);
|
|
@@ -353,6 +379,11 @@ export const Slideshow = observer((properties) => {
|
|
|
353
379
|
return;
|
|
354
380
|
setCurrentX(clientX);
|
|
355
381
|
const diff = clientX - startX;
|
|
382
|
+
// Past a few pixels of travel this is a drag, not a click — flag it so the trailing
|
|
383
|
+
// click (fired after mouseup/touchend) doesn't trigger slide onClick handlers.
|
|
384
|
+
if (Math.abs(diff) > DRAG_CLICK_THRESHOLD) {
|
|
385
|
+
hasDraggedRef.current = true;
|
|
386
|
+
}
|
|
356
387
|
setDragOffset(diff);
|
|
357
388
|
};
|
|
358
389
|
const handleDragEnd = () => {
|
|
@@ -434,7 +465,7 @@ export const Slideshow = observer((properties) => {
|
|
|
434
465
|
};
|
|
435
466
|
// Handle image click
|
|
436
467
|
const handleSlideClick = (slide, index) => {
|
|
437
|
-
if (slide.onClick && !isDragging) {
|
|
468
|
+
if (slide.onClick && !isDragging && !hasDraggedRef.current) {
|
|
438
469
|
slide.onClick(slide, index);
|
|
439
470
|
}
|
|
440
471
|
};
|
|
@@ -442,7 +473,9 @@ export const Slideshow = observer((properties) => {
|
|
|
442
473
|
const handleSlideKeyDown = (event, slide, index) => {
|
|
443
474
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
444
475
|
event.preventDefault();
|
|
445
|
-
|
|
476
|
+
if (slide.onClick && !isDragging) {
|
|
477
|
+
slide.onClick(slide, index);
|
|
478
|
+
}
|
|
446
479
|
}
|
|
447
480
|
};
|
|
448
481
|
// Keyboard navigation
|
|
@@ -576,7 +609,7 @@ export const Slideshow = observer((properties) => {
|
|
|
576
609
|
}), style: { transform: `translateX(${translateX}${translateUnit})` }, role: "group", "aria-label": `Slide group ${currentIndex} of ${totalDots}`,
|
|
577
610
|
// Touch events
|
|
578
611
|
// @ts-ignore - touch events
|
|
579
|
-
onTouchStart: touchDragging ? (event) => handleDragStart(event.touches[0]) : undefined,
|
|
612
|
+
onTouchStart: touchDragging ? (event) => handleDragStart(event.touches[0].clientX) : undefined,
|
|
580
613
|
// @ts-ignore - touch events
|
|
581
614
|
onTouchMove: touchDragging
|
|
582
615
|
? (event) => {
|
|
@@ -116,7 +116,7 @@ export const Swatches = observer((properties) => {
|
|
|
116
116
|
// default props
|
|
117
117
|
internalClassName: 'ss__swatches__slideshow',
|
|
118
118
|
loop: false,
|
|
119
|
-
|
|
119
|
+
slideWidth: 20, // Fixed swatch size so previews stay a consistent, legible size regardless of container width
|
|
120
120
|
slidesToMove: 1, // Add explicit slidesToMove
|
|
121
121
|
gap: 8, // Add smaller gap
|
|
122
122
|
showNavigation: true, // Enable navigation
|
package/dist/esm/components/src/components/Molecules/VariantSelection/VariantSelection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariantSelection.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/VariantSelection/VariantSelection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAM3B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAe,MAAM,gBAAgB,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AA2D/F,eAAO,MAAM,gBAAgB,gBAAyB,qBAAqB;;
|
|
1
|
+
{"version":3,"file":"VariantSelection.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/VariantSelection/VariantSelection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAM3B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAe,MAAM,gBAAgB,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AA2D/F,eAAO,MAAM,gBAAgB,gBAAyB,qBAAqB;;CA2LzE,CAAC;AASH,MAAM,MAAM,qBAAqB,GAAG;IACnC,SAAS,EAAE,oBAAoB,CAAC;CAChC,GAAG,mCAAmC,GACtC,cAAc,CAAC,qBAAqB,CAAC,CAAC;AAEvC,MAAM,MAAM,mCAAmC,GAAG;IACjD,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACtF,CAAC"}
|
|
@@ -148,7 +148,13 @@ export const VariantSelection = observer((properties) => {
|
|
|
148
148
|
'ss__variant-selection__option--selected': selected,
|
|
149
149
|
'ss__variant-selection__option--disabled': val.disabled,
|
|
150
150
|
'ss__variant-selection__option--unavailable': val.available === false,
|
|
151
|
-
}), onClick: (e) =>
|
|
151
|
+
}), onClick: (e) => {
|
|
152
|
+
if (!val.disabled) {
|
|
153
|
+
onSelectHandler(e, val);
|
|
154
|
+
// close the dropdown on selection
|
|
155
|
+
toggleOpen?.(e, false);
|
|
156
|
+
}
|
|
157
|
+
}, ref: (e) => useA11y(e), "aria-selected": selected, "aria-disabled": val.disabled || val.available === false, children: val.label }));
|
|
152
158
|
}) }));
|
|
153
159
|
};
|
|
154
160
|
return selection.values.length ? (_jsx(CacheProvider, { children: _jsx("div", { ...styling, className: classnames('ss__variant-selection', `ss__variant-selection--${type}`, `ss__variant-selection--${selection.field}`, className, internalClassName), children: (() => {
|