pixelize-design-library 2.4.2-beta.56 → 2.4.2-beta.57
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 +60 -0
- package/COMPONENT-GOTCHAS.md +48 -20
- package/DESIGN-GUIDE.md +18 -1
- package/dist/Components/AddressCard/AddressCard.d.ts +4 -0
- package/dist/Components/AddressCard/AddressCard.js +25 -0
- package/dist/Components/AddressCard/AddressCardGroup.d.ts +4 -0
- package/dist/Components/AddressCard/AddressCardGroup.js +7 -0
- package/dist/Components/AddressCard/AddressCardProps.d.ts +43 -0
- package/dist/Components/AddressCard/AddressCardProps.js +2 -0
- package/dist/Components/BagBar/BagBar.d.ts +4 -0
- package/dist/Components/BagBar/BagBar.js +32 -0
- package/dist/Components/BagBar/BagBarProps.d.ts +30 -0
- package/dist/Components/BagBar/BagBarProps.js +2 -0
- package/dist/Components/CartItem/CartItem.d.ts +4 -0
- package/dist/Components/CartItem/CartItem.js +60 -0
- package/dist/Components/CartItem/CartItemProps.d.ts +64 -0
- package/dist/Components/CartItem/CartItemProps.js +2 -0
- package/dist/Components/CartItem/cartItemOptions.d.ts +3 -0
- package/dist/Components/CartItem/cartItemOptions.js +13 -0
- package/dist/Components/CheckoutKit/selectable.d.ts +58 -0
- package/dist/Components/CheckoutKit/selectable.js +120 -0
- package/dist/Components/Commerce/commerceTypes.d.ts +52 -0
- package/dist/Components/Commerce/commerceTypes.js +2 -0
- package/dist/Components/Commerce/commerceVariants.d.ts +13 -0
- package/dist/Components/Commerce/commerceVariants.js +51 -0
- package/dist/Components/Commerce/index.d.ts +2 -0
- package/dist/Components/Commerce/index.js +18 -0
- package/dist/Components/Commerce/useContainerWidth.d.ts +3 -0
- package/dist/Components/Commerce/useContainerWidth.js +25 -0
- package/dist/Components/CouponField/CouponField.d.ts +4 -0
- package/dist/Components/CouponField/CouponField.js +72 -0
- package/dist/Components/CouponField/CouponFieldProps.d.ts +49 -0
- package/dist/Components/CouponField/CouponFieldProps.js +2 -0
- package/dist/Components/DatePicker/PickerPortal.d.ts +11 -0
- package/dist/Components/DatePicker/PickerPortal.js +26 -0
- package/dist/Components/DatePicker/RangeDatePicker.d.ts +1 -1
- package/dist/Components/DatePicker/RangeDatePicker.js +67 -32
- package/dist/Components/DatePicker/SingleDatePicker.js +49 -13
- package/dist/Components/DatePicker/TimeOnlyPicker.js +39 -4
- package/dist/Components/DetailSections/DetailSections.d.ts +4 -0
- package/dist/Components/DetailSections/DetailSections.js +112 -0
- package/dist/Components/DetailSections/DetailSectionsProps.d.ts +58 -0
- package/dist/Components/DetailSections/DetailSectionsProps.js +2 -0
- package/dist/Components/MediaGallery/MediaFrame.d.ts +31 -0
- package/dist/Components/MediaGallery/MediaFrame.js +55 -0
- package/dist/Components/MediaGallery/MediaGallery.d.ts +4 -0
- package/dist/Components/MediaGallery/MediaGallery.js +206 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.d.ts +76 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.js +20 -0
- package/dist/Components/MediaGallery/MediaLightbox.d.ts +4 -0
- package/dist/Components/MediaGallery/MediaLightbox.js +116 -0
- package/dist/Components/MediaGallery/MediaLightboxProps.d.ts +40 -0
- package/dist/Components/MediaGallery/MediaLightboxProps.js +15 -0
- package/dist/Components/MediaGallery/MediaThumb.d.ts +18 -0
- package/dist/Components/MediaGallery/MediaThumb.js +25 -0
- package/dist/Components/MediaGallery/glass.d.ts +31 -0
- package/dist/Components/MediaGallery/glass.js +47 -0
- package/dist/Components/MediaGallery/mediaGalleryModel.d.ts +22 -0
- package/dist/Components/MediaGallery/mediaGalleryModel.js +83 -0
- package/dist/Components/MediaGallery/motion.d.ts +5 -0
- package/dist/Components/MediaGallery/motion.js +12 -0
- package/dist/Components/MediaGallery/useMatchMedia.d.ts +2 -0
- package/dist/Components/MediaGallery/useMatchMedia.js +20 -0
- package/dist/Components/OffersList/OffersList.d.ts +4 -0
- package/dist/Components/OffersList/OffersList.js +83 -0
- package/dist/Components/OffersList/OffersListProps.d.ts +34 -0
- package/dist/Components/OffersList/OffersListProps.js +2 -0
- package/dist/Components/OptionChip/OptionChip.d.ts +4 -0
- package/dist/Components/OptionChip/OptionChip.js +97 -0
- package/dist/Components/OptionChip/OptionChipProps.d.ts +33 -0
- package/dist/Components/OptionChip/OptionChipProps.js +2 -0
- package/dist/Components/OptionChip/optionInk.d.ts +12 -0
- package/dist/Components/OptionChip/optionInk.js +25 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.d.ts +4 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.js +57 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.d.ts +29 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +2 -0
- package/dist/Components/OrderSummary/OrderSummary.d.ts +4 -0
- package/dist/Components/OrderSummary/OrderSummary.js +63 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.d.ts +53 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.js +2 -0
- package/dist/Components/PaymentOption/PaymentOption.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOption.js +24 -0
- package/dist/Components/PaymentOption/PaymentOptionGroup.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOptionGroup.js +7 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.d.ts +32 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.js +2 -0
- package/dist/Components/PincodeChecker/PincodeChecker.d.ts +4 -0
- package/dist/Components/PincodeChecker/PincodeChecker.js +175 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.d.ts +57 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.js +2 -0
- package/dist/Components/PriceBlock/PriceBlock.d.ts +4 -0
- package/dist/Components/PriceBlock/PriceBlock.js +41 -0
- package/dist/Components/PriceBlock/PriceBlockProps.d.ts +39 -0
- package/dist/Components/PriceBlock/PriceBlockProps.js +2 -0
- package/dist/Components/ProductBadges/ProductBadges.d.ts +4 -0
- package/dist/Components/ProductBadges/ProductBadges.js +61 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.d.ts +18 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.js +2 -0
- package/dist/Components/ProductCard/ProductCard.d.ts +3 -2
- package/dist/Components/ProductCard/ProductCard.js +103 -52
- package/dist/Components/ProductCard/ProductCardAction.d.ts +17 -0
- package/dist/Components/ProductCard/ProductCardAction.js +65 -0
- package/dist/Components/ProductCard/ProductCardGrid.d.ts +4 -0
- package/dist/Components/ProductCard/ProductCardGrid.js +20 -0
- package/dist/Components/ProductCard/ProductCardMedia.d.ts +18 -0
- package/dist/Components/ProductCard/ProductCardMedia.js +35 -0
- package/dist/Components/ProductCard/ProductCardProps.d.ts +138 -56
- package/dist/Components/ProductCard/ProductCardSkeleton.d.ts +4 -0
- package/dist/Components/ProductCard/ProductCardSkeleton.js +17 -0
- package/dist/Components/ProductCard/ProductCardSwatches.d.ts +15 -0
- package/dist/Components/ProductCard/ProductCardSwatches.js +37 -0
- package/dist/Components/ProductCard/QuickAddSheet.d.ts +4 -0
- package/dist/Components/ProductCard/QuickAddSheet.js +109 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.d.ts +38 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.js +2 -0
- package/dist/Components/ProductCard/cardLabels.d.ts +2 -0
- package/dist/Components/ProductCard/cardLabels.js +16 -0
- package/dist/Components/ProductCard/cardMetrics.d.ts +27 -0
- package/dist/Components/ProductCard/cardMetrics.js +55 -0
- package/dist/Components/ProductCard/productCardFixtures.d.ts +7 -0
- package/dist/Components/ProductCard/productCardFixtures.js +61 -0
- package/dist/Components/ProductCard/productCardModel.d.ts +22 -0
- package/dist/Components/ProductCard/productCardModel.js +79 -0
- package/dist/Components/ProductCard/useMinWidth.d.ts +2 -0
- package/dist/Components/ProductCard/useMinWidth.js +20 -0
- package/dist/Components/ProductDetails/ProductDetails.d.ts +3 -2
- package/dist/Components/ProductDetails/ProductDetails.js +209 -33
- package/dist/Components/ProductDetails/ProductDetailsProps.d.ts +143 -41
- package/dist/Components/ProductDetails/productDetailsModel.d.ts +14 -0
- package/dist/Components/ProductDetails/productDetailsModel.js +45 -0
- package/dist/Components/ProductDetails/useInViewport.d.ts +3 -0
- package/dist/Components/ProductDetails/useInViewport.js +18 -0
- package/dist/Components/QuantityStepper/QuantityStepper.d.ts +4 -0
- package/dist/Components/QuantityStepper/QuantityStepper.js +59 -0
- package/dist/Components/QuantityStepper/QuantityStepperProps.d.ts +24 -0
- package/dist/Components/QuantityStepper/QuantityStepperProps.js +2 -0
- package/dist/Components/Rating/Rating.d.ts +4 -0
- package/dist/Components/Rating/Rating.js +81 -0
- package/dist/Components/Rating/RatingProps.d.ts +27 -0
- package/dist/Components/Rating/RatingProps.js +2 -0
- package/dist/Components/ReviewList/ReviewList.d.ts +4 -0
- package/dist/Components/ReviewList/ReviewList.js +94 -0
- package/dist/Components/ReviewList/ReviewListProps.d.ts +68 -0
- package/dist/Components/ReviewList/ReviewListProps.js +2 -0
- package/dist/Components/ReviewSummary/ReviewSummary.d.ts +4 -0
- package/dist/Components/ReviewSummary/ReviewSummary.js +47 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.d.ts +31 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.js +2 -0
- package/dist/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/Components/SegmentedControl/SegmentedControl.js +17 -5
- package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +6 -0
- package/dist/Components/SegmentedControl/segmentedInk.d.ts +2 -0
- package/dist/Components/SegmentedControl/segmentedInk.js +4 -1
- package/dist/Components/SegmentedControl/useSlidingPill.d.ts +2 -0
- package/dist/Components/SegmentedControl/useSlidingPill.js +6 -1
- package/dist/Components/SideBar/SecondaryBar.js +13 -8
- package/dist/Components/SideBar/SideBarProps.d.ts +3 -1
- package/dist/Components/SideBar/components/MenuItemBox.js +47 -10
- package/dist/Components/SideBar/components/MenuPopoverContent.js +4 -3
- package/dist/Components/SpecTable/SpecTable.d.ts +4 -0
- package/dist/Components/SpecTable/SpecTable.js +39 -0
- package/dist/Components/SpecTable/SpecTableProps.d.ts +25 -0
- package/dist/Components/SpecTable/SpecTableProps.js +2 -0
- package/dist/Components/Spinner/Spinner.d.ts +1 -1
- package/dist/Components/Spinner/Spinner.js +2 -2
- package/dist/Components/Spinner/SpinnerProps.d.ts +2 -0
- package/dist/Components/StageProgress/StepperStage.js +2 -1
- package/dist/Components/StatCard/StatCard.d.ts +1 -1
- package/dist/Components/StatCard/StatCard.js +2 -2
- package/dist/Components/StatCard/StatCardProps.d.ts +4 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.d.ts +3 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.js +85 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.d.ts +54 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.js +2 -0
- package/dist/Components/StockStatus/StockStatus.d.ts +4 -0
- package/dist/Components/StockStatus/StockStatus.js +31 -0
- package/dist/Components/StockStatus/StockStatusProps.d.ts +14 -0
- package/dist/Components/StockStatus/StockStatusProps.js +2 -0
- package/dist/Components/Table/Table.js +2 -1
- package/dist/Components/Table/TableProps.d.ts +5 -2
- package/dist/Components/Table/columnLabel.d.ts +6 -0
- package/dist/Components/Table/columnLabel.js +27 -0
- package/dist/Components/Table/components/TableBody.js +5 -1
- package/dist/Components/Table/components/TableHeader.js +3 -2
- package/dist/Components/Table/filters/ActiveFilters.js +2 -1
- package/dist/Components/Table/filters/TableFilters.js +2 -1
- package/dist/Components/Table/hooks/useTable.js +3 -2
- package/dist/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/Components/Table/settings/TableSettings.js +2 -1
- package/dist/Components/TrustBadges/TrustBadges.d.ts +4 -0
- package/dist/Components/TrustBadges/TrustBadges.js +24 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.d.ts +20 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.js +2 -0
- package/dist/Components/VariantSelector/VariantSelector.d.ts +4 -0
- package/dist/Components/VariantSelector/VariantSelector.js +123 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.d.ts +27 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.js +2 -0
- package/dist/Components/VariantSelector/variantSelection.d.ts +6 -0
- package/dist/Components/VariantSelector/variantSelection.js +25 -0
- package/dist/Components/WishlistToggle/WishlistToggle.d.ts +4 -0
- package/dist/Components/WishlistToggle/WishlistToggle.js +65 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.d.ts +19 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.js +2 -0
- package/dist/Theme/assertPalette.d.ts +1 -1
- package/dist/Theme/assertPalette.js +1 -1
- package/dist/Theme/tokens/brands/index.js +2 -0
- package/dist/Theme/tokens/brands/zinc/palette.dark.d.ts +1 -0
- package/dist/Theme/tokens/builders/buildDarkPalette.js +2 -0
- package/dist/Theme/tokens/builders/index.d.ts +1 -0
- package/dist/Theme/tokens/builders/index.js +1 -0
- package/dist/Theme/tokens/builders/rechartsTheme.d.ts +56 -0
- package/dist/Theme/tokens/builders/rechartsTheme.js +43 -0
- package/dist/Theme/tokens/builders/star.d.ts +3 -0
- package/dist/Theme/tokens/builders/star.js +8 -0
- package/dist/Theme/tokens/types.d.ts +3 -1
- package/dist/Theme/useChartTheme.d.ts +4 -0
- package/dist/Theme/useChartTheme.js +12 -0
- package/dist/Utils/price.d.ts +16 -0
- package/dist/Utils/price.js +34 -0
- package/dist/esm/Components/AddressCard/AddressCard.js +20 -0
- package/dist/esm/Components/AddressCard/AddressCardGroup.js +5 -0
- package/dist/esm/Components/AddressCard/AddressCardProps.js +1 -0
- package/dist/esm/Components/BagBar/BagBar.js +27 -0
- package/dist/esm/Components/BagBar/BagBarProps.js +1 -0
- package/dist/esm/Components/CartItem/CartItem.js +55 -0
- package/dist/esm/Components/CartItem/CartItemProps.js +1 -0
- package/dist/esm/Components/CartItem/cartItemOptions.js +9 -0
- package/dist/esm/Components/CheckoutKit/selectable.js +112 -0
- package/dist/esm/Components/Commerce/commerceTypes.js +1 -0
- package/dist/esm/Components/Commerce/commerceVariants.js +41 -0
- package/dist/esm/Components/Commerce/index.js +2 -0
- package/dist/esm/Components/Commerce/useContainerWidth.js +21 -0
- package/dist/esm/Components/CouponField/CouponField.js +67 -0
- package/dist/esm/Components/CouponField/CouponFieldProps.js +1 -0
- package/dist/esm/Components/DatePicker/PickerPortal.js +21 -0
- package/dist/esm/Components/DatePicker/RangeDatePicker.js +34 -32
- package/dist/esm/Components/DatePicker/SingleDatePicker.js +16 -13
- package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +6 -4
- package/dist/esm/Components/DetailSections/DetailSections.js +107 -0
- package/dist/esm/Components/DetailSections/DetailSectionsProps.js +1 -0
- package/dist/esm/Components/MediaGallery/MediaFrame.js +48 -0
- package/dist/esm/Components/MediaGallery/MediaGallery.js +201 -0
- package/dist/esm/Components/MediaGallery/MediaGalleryProps.js +17 -0
- package/dist/esm/Components/MediaGallery/MediaLightbox.js +78 -0
- package/dist/esm/Components/MediaGallery/MediaLightboxProps.js +12 -0
- package/dist/esm/Components/MediaGallery/MediaThumb.js +23 -0
- package/dist/esm/Components/MediaGallery/glass.js +42 -0
- package/dist/esm/Components/MediaGallery/mediaGalleryModel.js +71 -0
- package/dist/esm/Components/MediaGallery/motion.js +8 -0
- package/dist/esm/Components/MediaGallery/useMatchMedia.js +16 -0
- package/dist/esm/Components/OffersList/OffersList.js +81 -0
- package/dist/esm/Components/OffersList/OffersListProps.js +1 -0
- package/dist/esm/Components/OptionChip/OptionChip.js +95 -0
- package/dist/esm/Components/OptionChip/OptionChipProps.js +1 -0
- package/dist/esm/Components/OptionChip/optionInk.js +21 -0
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimeline.js +55 -0
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +1 -0
- package/dist/esm/Components/OrderSummary/OrderSummary.js +58 -0
- package/dist/esm/Components/OrderSummary/OrderSummaryProps.js +1 -0
- package/dist/esm/Components/PaymentOption/PaymentOption.js +19 -0
- package/dist/esm/Components/PaymentOption/PaymentOptionGroup.js +5 -0
- package/dist/esm/Components/PaymentOption/PaymentOptionProps.js +1 -0
- package/dist/esm/Components/PincodeChecker/PincodeChecker.js +170 -0
- package/dist/esm/Components/PincodeChecker/PincodeCheckerProps.js +1 -0
- package/dist/esm/Components/PriceBlock/PriceBlock.js +39 -0
- package/dist/esm/Components/PriceBlock/PriceBlockProps.js +1 -0
- package/dist/esm/Components/ProductBadges/ProductBadges.js +59 -0
- package/dist/esm/Components/ProductBadges/ProductBadgesProps.js +1 -0
- package/dist/esm/Components/ProductCard/ProductCard.js +105 -54
- package/dist/esm/Components/ProductCard/ProductCardAction.js +60 -0
- package/dist/esm/Components/ProductCard/ProductCardGrid.js +18 -0
- package/dist/esm/Components/ProductCard/ProductCardMedia.js +33 -0
- package/dist/esm/Components/ProductCard/ProductCardSkeleton.js +12 -0
- package/dist/esm/Components/ProductCard/ProductCardSwatches.js +35 -0
- package/dist/esm/Components/ProductCard/QuickAddSheet.js +71 -0
- package/dist/esm/Components/ProductCard/QuickAddSheetProps.js +1 -0
- package/dist/esm/Components/ProductCard/cardLabels.js +13 -0
- package/dist/esm/Components/ProductCard/cardMetrics.js +52 -0
- package/dist/esm/Components/ProductCard/productCardFixtures.js +58 -0
- package/dist/esm/Components/ProductCard/productCardModel.js +65 -0
- package/dist/esm/Components/ProductCard/useMinWidth.js +16 -0
- package/dist/esm/Components/ProductDetails/ProductDetails.js +210 -34
- package/dist/esm/Components/ProductDetails/productDetailsModel.js +35 -0
- package/dist/esm/Components/ProductDetails/useInViewport.js +14 -0
- package/dist/esm/Components/QuantityStepper/QuantityStepper.js +57 -0
- package/dist/esm/Components/QuantityStepper/QuantityStepperProps.js +1 -0
- package/dist/esm/Components/Rating/Rating.js +79 -0
- package/dist/esm/Components/Rating/RatingProps.js +1 -0
- package/dist/esm/Components/ReviewList/ReviewList.js +89 -0
- package/dist/esm/Components/ReviewList/ReviewListProps.js +1 -0
- package/dist/esm/Components/ReviewSummary/ReviewSummary.js +42 -0
- package/dist/esm/Components/ReviewSummary/ReviewSummaryProps.js +1 -0
- package/dist/esm/Components/SegmentedControl/SegmentedControl.js +19 -7
- package/dist/esm/Components/SegmentedControl/segmentedInk.js +2 -0
- package/dist/esm/Components/SegmentedControl/useSlidingPill.js +6 -1
- package/dist/esm/Components/SideBar/SecondaryBar.js +14 -9
- package/dist/esm/Components/SideBar/components/MenuItemBox.js +14 -10
- package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +4 -3
- package/dist/esm/Components/SpecTable/SpecTable.js +34 -0
- package/dist/esm/Components/SpecTable/SpecTableProps.js +1 -0
- package/dist/esm/Components/Spinner/Spinner.js +2 -2
- package/dist/esm/Components/StageProgress/StepperStage.js +2 -1
- package/dist/esm/Components/StatCard/StatCard.js +2 -2
- package/dist/esm/Components/StickyBuyBar/StickyBuyBar.js +80 -0
- package/dist/esm/Components/StickyBuyBar/StickyBuyBarProps.js +1 -0
- package/dist/esm/Components/StockStatus/StockStatus.js +29 -0
- package/dist/esm/Components/StockStatus/StockStatusProps.js +1 -0
- package/dist/esm/Components/Table/Table.js +2 -1
- package/dist/esm/Components/Table/columnLabel.js +21 -0
- package/dist/esm/Components/Table/components/TableBody.js +5 -1
- package/dist/esm/Components/Table/components/TableHeader.js +3 -2
- package/dist/esm/Components/Table/filters/ActiveFilters.js +2 -1
- package/dist/esm/Components/Table/filters/TableFilters.js +2 -1
- package/dist/esm/Components/Table/hooks/useTable.js +3 -2
- package/dist/esm/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/esm/Components/Table/settings/TableSettings.js +2 -1
- package/dist/esm/Components/TrustBadges/TrustBadges.js +22 -0
- package/dist/esm/Components/TrustBadges/TrustBadgesProps.js +1 -0
- package/dist/esm/Components/VariantSelector/VariantSelector.js +118 -0
- package/dist/esm/Components/VariantSelector/VariantSelectorProps.js +1 -0
- package/dist/esm/Components/VariantSelector/variantSelection.js +19 -0
- package/dist/esm/Components/WishlistToggle/WishlistToggle.js +63 -0
- package/dist/esm/Components/WishlistToggle/WishlistToggleProps.js +1 -0
- package/dist/esm/Theme/assertPalette.js +1 -1
- package/dist/esm/Theme/tokens/brands/index.js +2 -0
- package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +2 -0
- package/dist/esm/Theme/tokens/builders/index.js +1 -0
- package/dist/esm/Theme/tokens/builders/rechartsTheme.js +37 -0
- package/dist/esm/Theme/tokens/builders/star.js +4 -0
- package/dist/esm/Theme/useChartTheme.js +8 -0
- package/dist/esm/Utils/price.js +27 -0
- package/dist/esm/index.js +36 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +86 -4
- package/package.json +1 -1
- package/dist/Components/ProductCard/ProductLabel.d.ts +0 -7
- package/dist/Components/ProductCard/ProductLabel.js +0 -20
- package/dist/Components/ProductCard/ProductPrice.d.ts +0 -10
- package/dist/Components/ProductCard/ProductPrice.js +0 -126
- package/dist/Components/ProductCard/ProductReview.d.ts +0 -8
- package/dist/Components/ProductCard/ProductReview.js +0 -30
- package/dist/Components/ProductCard/ProductTags.d.ts +0 -8
- package/dist/Components/ProductCard/ProductTags.js +0 -53
- package/dist/Components/ProductDetails/ProductDtlPrice.d.ts +0 -7
- package/dist/Components/ProductDetails/ProductDtlPrice.js +0 -24
- package/dist/Components/ProductDetails/ProductImageSlider.d.ts +0 -13
- package/dist/Components/ProductDetails/ProductImageSlider.js +0 -240
- package/dist/esm/Components/ProductCard/ProductLabel.js +0 -18
- package/dist/esm/Components/ProductCard/ProductPrice.js +0 -121
- package/dist/esm/Components/ProductCard/ProductReview.js +0 -28
- package/dist/esm/Components/ProductCard/ProductTags.js +0 -48
- package/dist/esm/Components/ProductDetails/ProductDtlPrice.js +0 -22
- package/dist/esm/Components/ProductDetails/ProductImageSlider.js +0 -204
|
@@ -1,62 +1,113 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { Box,
|
|
4
|
-
import
|
|
5
|
-
import ProductPrice from "./ProductPrice.js";
|
|
6
|
-
import Button from "../Button/Button.js";
|
|
7
|
-
import ProductLabel from "./ProductLabel.js";
|
|
2
|
+
import { useId, useState } from "react";
|
|
3
|
+
import { Box, Flex, Text, VisuallyHidden } from "@chakra-ui/react";
|
|
4
|
+
import { Check } from "lucide-react";
|
|
8
5
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
7
|
+
import { reducedMotionSx, usePrefersReducedMotion } from "../../Theme/chakra/motion.js";
|
|
8
|
+
import { focusVisibleRing } from "../../Theme/chakra/focusRing.styles.js";
|
|
9
|
+
import PriceBlock from "../PriceBlock/PriceBlock.js";
|
|
10
|
+
import ProductBadges from "../ProductBadges/ProductBadges.js";
|
|
11
|
+
import Rating from "../Rating/Rating.js";
|
|
12
|
+
import StockStatus from "../StockStatus/StockStatus.js";
|
|
13
|
+
import WishlistToggle from "../WishlistToggle/WishlistToggle.js";
|
|
14
|
+
import { optionInk } from "../OptionChip/optionInk.js";
|
|
15
|
+
import { DEFAULT_LABELS } from "./cardLabels.js";
|
|
16
|
+
import { DENSITY, FINE_POINTER, MEDIA_RADIUS, TITLE_LINES } from "./cardMetrics.js";
|
|
17
|
+
import { DEFAULT_SWATCH_LIMIT, deriveAction, framesFor, lowStockCount, rangeOf, soleVariantOf, swatchAxisOf, valueSoldOut, variantsFor, isSoldOut, } from "./productCardModel.js";
|
|
18
|
+
import ProductCardAction from "./ProductCardAction.js";
|
|
19
|
+
import ProductCardMedia from "./ProductCardMedia.js";
|
|
20
|
+
import ProductCardSkeleton from "./ProductCardSkeleton.js";
|
|
21
|
+
import ProductCardSwatches from "./ProductCardSwatches.js";
|
|
22
|
+
import QuickAddSheet from "./QuickAddSheet.js";
|
|
23
|
+
const NO_AXES = [];
|
|
24
|
+
const NO_VARIANTS = [];
|
|
25
|
+
/** Chromeless product card: tonal media well, brand, title, rating, price and one action; the whole card is one link target. */
|
|
26
|
+
const ProductCard = (props) => {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const { title, brand, media, alt, price, mrp, unitPrice, rating, ratingCount, badges, axes = NO_AXES, variants = NO_VARIANTS, mediaIdsByOption, swatchLimit = DEFAULT_SWATCH_LIMIT, stock, outOfStock, href, linkAs, linkProps, onPress, layout = "grid", density = "comfortable", aspectRatio = "4/5", action: actionOverride, quantity, onQuantityChange, onAdd, quickAddPresentation, quickAddDrawerProps, onRemove, onNotify, wishlisted, onWishlistChange, selected = false, isLoading = false, mediaOverlay, meta, actions, labels, currency, locale, "data-testid": testId, } = props;
|
|
29
|
+
const { colors } = useCustomTheme();
|
|
30
|
+
const reduced = usePrefersReducedMotion();
|
|
31
|
+
const titleId = useId();
|
|
32
|
+
const [sheetOpen, setSheetOpen] = useState(false);
|
|
33
|
+
const [picked, setPicked] = useState(null);
|
|
34
|
+
const [previewed, setPreviewed] = useState(null);
|
|
35
|
+
const [innerQuantity, setInnerQuantity] = useState(0);
|
|
36
|
+
const [pressed, setPressed] = useState(false);
|
|
37
|
+
if (isLoading)
|
|
38
|
+
return _jsx(ProductCardSkeleton, { layout: layout, density: density, aspectRatio: aspectRatio, "data-testid": testId });
|
|
39
|
+
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
40
|
+
const m = DENSITY[density];
|
|
41
|
+
const horizontal = layout === "list";
|
|
42
|
+
const rail = layout === "rail";
|
|
43
|
+
const soldOut = isSoldOut(outOfStock, stock, variants);
|
|
44
|
+
const sole = soleVariantOf(axes, variants);
|
|
45
|
+
const action = deriveAction(actionOverride, soldOut, axes);
|
|
46
|
+
const left = soldOut ? undefined : lowStockCount(stock, sole);
|
|
47
|
+
const bagged = quantity !== null && quantity !== void 0 ? quantity : innerQuantity;
|
|
48
|
+
const maxQuantity = (() => {
|
|
49
|
+
const count = stock !== null && stock !== void 0 ? stock : sole === null || sole === void 0 ? void 0 : sole.stock;
|
|
50
|
+
return count !== undefined && count > 0 ? count : undefined;
|
|
51
|
+
})();
|
|
52
|
+
const swatchAxis = swatchAxisOf(axes);
|
|
53
|
+
const activeId = (_a = previewed !== null && previewed !== void 0 ? previewed : picked) !== null && _a !== void 0 ? _a : (_b = swatchAxis === null || swatchAxis === void 0 ? void 0 : swatchAxis.values[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
54
|
+
const frames = framesFor(media, mediaIdsByOption, swatchAxis === null || swatchAxis === void 0 ? void 0 : swatchAxis.id, activeId);
|
|
55
|
+
const priced = variantsFor(variants, swatchAxis === null || swatchAxis === void 0 ? void 0 : swatchAxis.id, picked !== null && picked !== void 0 ? picked : undefined);
|
|
56
|
+
const range = sole ? undefined : rangeOf(priced);
|
|
57
|
+
const soldOutValues = new Set(swatchAxis ? swatchAxis.values.filter((value) => valueSoldOut(variants, swatchAxis.id, value.id)).map((value) => value.id) : []);
|
|
58
|
+
const interactive = !!href || !!linkAs || !!onPress;
|
|
59
|
+
const LinkTag = href || linkAs ? (linkAs !== null && linkAs !== void 0 ? linkAs : "a") : "button";
|
|
60
|
+
const linkExtras = href || linkAs ? { href, ...linkProps } : { type: "button" };
|
|
61
|
+
const add = () => {
|
|
62
|
+
if (quantity === undefined)
|
|
63
|
+
setInnerQuantity(1);
|
|
64
|
+
onAdd === null || onAdd === void 0 ? void 0 : onAdd(sole === null || sole === void 0 ? void 0 : sole.id, 1);
|
|
20
65
|
};
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
66
|
+
const press = () => {
|
|
67
|
+
if (action === "notify")
|
|
68
|
+
onNotify === null || onNotify === void 0 ? void 0 : onNotify();
|
|
69
|
+
else if (action === "options")
|
|
70
|
+
setSheetOpen(true);
|
|
71
|
+
else
|
|
72
|
+
add();
|
|
26
73
|
};
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
74
|
+
const changeQuantity = (next) => {
|
|
75
|
+
if (quantity === undefined)
|
|
76
|
+
setInnerQuantity(next);
|
|
77
|
+
onQuantityChange === null || onQuantityChange === void 0 ? void 0 : onQuantityChange(next);
|
|
32
78
|
};
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
md: { cardWidth: "20rem", imgHeight: "15rem", padding: 5 },
|
|
37
|
-
lg: { cardWidth: "22rem", imgHeight: "17rem", padding: 6 },
|
|
79
|
+
const remove = () => {
|
|
80
|
+
changeQuantity(0);
|
|
81
|
+
onRemove === null || onRemove === void 0 ? void 0 : onRemove();
|
|
38
82
|
};
|
|
39
|
-
const {
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
83
|
+
const defaultControl = (_jsx(ProductCardAction, { kind: action, title: title, labels: copy, placement: horizontal ? "inline" : "media", inset: m.actionInset, hoverBar: density === "spacious" && !horizontal, quantity: action === "notify" ? 0 : bagged, maxQuantity: maxQuantity, onPress: press, onQuantityChange: changeQuantity, onRemove: remove }));
|
|
84
|
+
const slotted = horizontal ? (_jsx(Box, { "data-control": true, position: "relative", zIndex: 2, children: actions })) : (_jsx(Box, { "data-control": true, position: "absolute", right: m.actionInset, bottom: m.actionInset, zIndex: 2, children: actions }));
|
|
85
|
+
const control = actions ? slotted : defaultControl;
|
|
86
|
+
const wishlist = (_jsx(WishlistToggle, { variant: horizontal ? "soft" : "glass", size: "md", label: copy.save(title), selected: wishlisted, onSelectedChange: onWishlistChange }));
|
|
87
|
+
const hoverFrame = previewed === null ? frames[1] : undefined;
|
|
88
|
+
const pressable = interactive && !reduced;
|
|
89
|
+
const ink = optionInk(colors).selected;
|
|
90
|
+
const metaLine = meta !== null && meta !== void 0 ? meta : (left !== undefined ? _jsx(StockStatus, { status: "low-stock", count: left, size: "sm" }) : null);
|
|
91
|
+
return (_jsxs(Box, { as: "article", "aria-labelledby": titleId, "data-testid": testId, "data-layout": layout, "data-density": density, "data-soldout": soldOut || undefined, "data-selected": selected || undefined, "data-pressed": pressed || undefined, onPointerDown: (event) => setPressed(!event.target.closest("[data-control]")), onPointerUp: () => setPressed(false), onPointerLeave: () => setPressed(false), onPointerCancel: () => setPressed(false), position: "relative", display: "flex", flexDirection: horizontal ? "row" : "column", gap: horizontal ? 3 : 0, flexGrow: rail ? 0 : 1, flexShrink: rail ? 0 : 1, w: rail ? m.railWidth : "100%", minW: 0, cursor: interactive ? "pointer" : "default", transition: transitionFor(["transform"]), sx: {
|
|
92
|
+
...(rail ? { scrollSnapAlign: "start" } : {}),
|
|
93
|
+
...reducedMotionSx(),
|
|
94
|
+
...(pressable ? { "&[data-pressed]": { transform: "scale(0.98)" } } : {}),
|
|
95
|
+
[FINE_POINTER]: {
|
|
96
|
+
"&:hover [data-hover-frame], &:focus-within [data-hover-frame]": { opacity: 1 },
|
|
97
|
+
"&:hover [data-bar], &:focus-within [data-bar]": { opacity: 1, transform: "none" },
|
|
98
|
+
...(reduced ? {} : { "&:hover [data-primary]": { transform: "scale(1.03)" } }),
|
|
99
|
+
},
|
|
100
|
+
}, children: [_jsxs(ProductCardMedia, { primary: frames[0], hover: hoverFrame, title: title, alt: alt, aspectRatio: aspectRatio, dimmed: soldOut, selected: selected, fallbackText: copy.imageUnavailable, width: horizontal ? m.listMedia : undefined, children: [!soldOut && badges && badges.length > 0 ? (_jsx(Box, { position: "absolute", top: m.badgeInset, insetStart: m.badgeInset, zIndex: 2, maxW: "calc(100% - 3.5rem)", pointerEvents: "none", children: _jsx(ProductBadges, { badges: badges, max: 2, size: "sm", variant: "solid" }) })) : null, !horizontal ? (_jsx(Box, { "data-control": true, position: "absolute", top: m.wishlistInset, insetEnd: m.wishlistInset, zIndex: 2, children: wishlist })) : null, selected ? (_jsx(Box, { "aria-hidden": true, position: "absolute", bottom: m.actionInset, insetStart: m.actionInset, zIndex: 2, display: "inline-flex", alignItems: "center", justifyContent: "center", boxSize: "1.5rem", borderRadius: "full", bg: ink.fill, color: ink.ink, children: _jsx(Check, { size: 14, strokeWidth: 3 }) })) : null, mediaOverlay ? (_jsx(Box, { position: "absolute", inset: 0, zIndex: 2, pointerEvents: "none", sx: { "& > *": { pointerEvents: "auto" } }, children: mediaOverlay })) : null, !horizontal ? control : null] }), _jsxs(Flex, { direction: "column", flex: 1, minW: 0, gap: m.bodyGap, pt: horizontal ? 0 : m.bodyTop, children: [brand ? (_jsx(Text, { as: "span", fontSize: m.brand.size, lineHeight: `${m.brand.line}px`, fontWeight: 500, color: colors.textMuted, noOfLines: 1, children: brand })) : null, _jsx(Text, { as: "h3", id: titleId, m: 0, fontSize: m.title.size, lineHeight: `${m.title.line}px`, fontWeight: 500, color: colors.header[900], noOfLines: TITLE_LINES, minH: horizontal ? undefined : `${m.title.line * TITLE_LINES}px`, children: interactive ? (_jsx(Box, { as: LinkTag, ...linkExtras, "data-card-link": true, onClick: onPress, color: "inherit", textAlign: "start", textDecoration: "none", cursor: "pointer", sx: {
|
|
101
|
+
font: "inherit",
|
|
102
|
+
background: "none",
|
|
103
|
+
border: 0,
|
|
104
|
+
p: 0,
|
|
105
|
+
outline: "none",
|
|
106
|
+
"&::after": { content: '""', position: "absolute", inset: 0, zIndex: 1, borderRadius: MEDIA_RADIUS },
|
|
107
|
+
"&:focus-visible::after": focusVisibleRing(colors),
|
|
108
|
+
}, children: title })) : (title) }), selected ? _jsx(VisuallyHidden, { children: copy.selected }) : null, rating !== undefined && rating > 0 ? (_jsx(Rating, { value: rating, count: ratingCount, size: "xs", compactCount: true })) : horizontal ? null : (_jsx(Box, { minH: "1rem", "aria-hidden": true })), _jsx(PriceBlock, { size: m.price, price: price, mrp: soldOut ? undefined : mrp, priceRange: range, unitPrice: unitPrice, currency: currency, locale: locale }), soldOut ? _jsx(StockStatus, { status: "out-of-stock", message: copy.soldOut, size: "sm" }) : null, metaLine, swatchAxis && activeId ? (_jsx(ProductCardSwatches, { axis: swatchAxis, limit: swatchLimit, dot: m.dot, activeId: activeId, soldOutIds: soldOutValues, labels: copy, onPreview: setPreviewed, onPick: setPicked })) : null, horizontal ? (_jsxs(Flex, { "data-control": true, position: "relative", zIndex: 2, mt: "auto", pt: 2, align: "center", justify: "space-between", gap: 1, children: [wishlist, control] })) : null] }), action === "options" ? (_jsx(QuickAddSheet, { isOpen: sheetOpen, onClose: () => setSheetOpen(false), title: title, brand: brand, media: frames[0], axes: axes, variants: variants, defaultSelection: swatchAxis && picked ? { [swatchAxis.id]: picked } : undefined, currency: currency, locale: locale, presentation: quickAddPresentation, drawerContentProps: quickAddDrawerProps, onConfirm: (variant, count) => {
|
|
109
|
+
onAdd === null || onAdd === void 0 ? void 0 : onAdd(variant.id, count);
|
|
110
|
+
setSheetOpen(false);
|
|
111
|
+
} })) : null] }));
|
|
61
112
|
};
|
|
62
113
|
export default ProductCard;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "@chakra-ui/react";
|
|
3
|
+
import { keyframes } from "@emotion/react";
|
|
4
|
+
import { Bell, Plus } from "lucide-react";
|
|
5
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
|
+
import { MOTION_EASE, transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
7
|
+
import { overlayScrim } from "../../Theme/tokens/builders/scrim.js";
|
|
8
|
+
import { reducedMotionSx, usePrefersReducedMotion } from "../../Theme/chakra/motion.js";
|
|
9
|
+
import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
|
|
10
|
+
import QuantityStepper from "../QuantityStepper/QuantityStepper.js";
|
|
11
|
+
import { FINE_POINTER } from "./cardMetrics.js";
|
|
12
|
+
const morphIn = keyframes `
|
|
13
|
+
0% { opacity: 0; transform: scale(0.85); }
|
|
14
|
+
100% { opacity: 1; transform: scale(1); }
|
|
15
|
+
`;
|
|
16
|
+
const DISC = "2.25rem";
|
|
17
|
+
const BAR_HEIGHT = "2.5rem";
|
|
18
|
+
/** The card's one control: glass circle (or hover bar), notify pill, or the stepper it morphs into. */
|
|
19
|
+
const ProductCardAction = ({ kind, title, labels, placement, inset, hoverBar, quantity, maxQuantity, onPress, onQuantityChange, onRemove, }) => {
|
|
20
|
+
const { colors } = useCustomTheme();
|
|
21
|
+
const reduced = usePrefersReducedMotion();
|
|
22
|
+
const onMedia = placement === "media";
|
|
23
|
+
const place = onMedia
|
|
24
|
+
? { position: "absolute", right: inset, bottom: inset, zIndex: 2 }
|
|
25
|
+
: { position: "relative", zIndex: 2 };
|
|
26
|
+
if (quantity > 0) {
|
|
27
|
+
return (_jsx(Box, { "data-control": true, "data-stepper": true, ...place, display: "inline-flex", borderRadius: "full", bg: onMedia ? colors.surfaceRaised : colors.transparent, boxShadow: onMedia ? "sm" : "none", animation: reduced ? undefined : `${morphIn} 200ms ${MOTION_EASE}`, children: _jsx(QuantityStepper, { size: "sm", value: quantity, min: 1, max: maxQuantity, removable: true, itemLabel: title, onValueChange: onQuantityChange, onRemove: onRemove }) }));
|
|
28
|
+
}
|
|
29
|
+
const isNotify = kind === "notify";
|
|
30
|
+
const name = isNotify ? labels.notifyMeFor(title) : kind === "options" ? labels.chooseOptions(title) : labels.addToBag(title);
|
|
31
|
+
const barText = kind === "options" ? labels.chooseOptionsText : labels.addToBagText;
|
|
32
|
+
const bar = onMedia && hoverBar && !isNotify;
|
|
33
|
+
const look = onMedia
|
|
34
|
+
? { bg: overlayScrim(colors), hoverBg: overlayScrim(colors), color: colors.white }
|
|
35
|
+
: { bg: colors.background[100], hoverBg: colors.background[200], color: colors.header[900] };
|
|
36
|
+
return (_jsxs(Box, { as: "button", type: "button", "data-control": true, "data-bar": bar || undefined, "data-action": kind, "aria-label": name, onClick: onPress, ...place, display: "inline-flex", alignItems: "center", justifyContent: "center", gap: 1.5, h: DISC, minW: DISC, px: isNotify ? 3 : 0, borderRadius: "full", bg: look.bg, color: look.color, cursor: "pointer", transition: transitionFor(["background-color", "opacity", "transform"], "base"), _hover: { bg: look.hoverBg }, _active: reduced ? undefined : { transform: "scale(0.9)" }, sx: {
|
|
37
|
+
outline: "none",
|
|
38
|
+
...(onMedia ? { backdropFilter: "blur(8px)", WebkitBackdropFilter: "blur(8px)" } : {}),
|
|
39
|
+
...focusVisibleStyles(colors),
|
|
40
|
+
...reducedMotionSx({ "&:active": { transform: "none" } }),
|
|
41
|
+
"&::before": { content: '""', position: "absolute", inset: "-0.25rem" },
|
|
42
|
+
"& [data-label]": { display: isNotify ? "inline" : "none" },
|
|
43
|
+
...(bar
|
|
44
|
+
? {
|
|
45
|
+
[FINE_POINTER]: {
|
|
46
|
+
left: inset,
|
|
47
|
+
right: "auto",
|
|
48
|
+
width: `calc(100% - 2 * ${inset})`,
|
|
49
|
+
height: BAR_HEIGHT,
|
|
50
|
+
borderRadius: "lg",
|
|
51
|
+
opacity: 0,
|
|
52
|
+
transform: reduced ? "none" : "translateY(0.5rem)",
|
|
53
|
+
"& [data-label]": { display: "inline" },
|
|
54
|
+
"&:focus-visible": { opacity: 1, transform: "none" },
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
: {}),
|
|
58
|
+
}, children: [isNotify ? _jsx(Bell, { size: 16, "aria-hidden": true }) : _jsx(Plus, { size: 18, strokeWidth: 2.25, "aria-hidden": true }), _jsx(Text, { as: "span", "data-label": true, fontSize: "0.8125rem", fontWeight: 600, lineHeight: 1, whiteSpace: "nowrap", children: isNotify ? labels.notifyMe : barText })] }));
|
|
59
|
+
};
|
|
60
|
+
export default ProductCardAction;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Children } from "react";
|
|
3
|
+
import { Box } from "@chakra-ui/react";
|
|
4
|
+
const DEFAULT_COLUMNS = { base: 2, sm: 2, md: 3, lg: 4, xl: 5 };
|
|
5
|
+
const template = (columns) => `repeat(${columns}, minmax(0, 1fr))`;
|
|
6
|
+
/** List of cards on one grid: 12 px columns and 24 px rows on a phone, 24 and 32 from lg (override with `gap`), rows level in height. */
|
|
7
|
+
const ProductCardGrid = ({ children, columns, gap, columnGap, rowGap, "aria-label": ariaLabel, "data-testid": testId }) => {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const cols = { ...DEFAULT_COLUMNS, ...columns };
|
|
10
|
+
return (_jsx(Box, { as: "ul", role: "list", "aria-label": ariaLabel, "data-testid": testId, listStyleType: "none", m: 0, p: 0, display: "grid", alignItems: "stretch", columnGap: (_a = columnGap !== null && columnGap !== void 0 ? columnGap : gap) !== null && _a !== void 0 ? _a : { base: "0.75rem", lg: "1.5rem" }, rowGap: (_b = rowGap !== null && rowGap !== void 0 ? rowGap : gap) !== null && _b !== void 0 ? _b : { base: "1.5rem", lg: "2rem" }, gridTemplateColumns: {
|
|
11
|
+
base: template(cols.base),
|
|
12
|
+
sm: template(cols.sm),
|
|
13
|
+
md: template(cols.md),
|
|
14
|
+
lg: template(cols.lg),
|
|
15
|
+
xl: template(cols.xl),
|
|
16
|
+
}, children: Children.toArray(children).map((child, index) => (_jsx(Box, { as: "li", display: "flex", minW: 0, children: _jsx(Box, { display: "flex", flexDirection: "column", flex: 1, minW: 0, children: child }) }, index))) }));
|
|
17
|
+
};
|
|
18
|
+
export default ProductCardGrid;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { Box, Text } from "@chakra-ui/react";
|
|
4
|
+
import { ImageOff } from "lucide-react";
|
|
5
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
|
+
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
7
|
+
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
8
|
+
import { CSS_RATIO, MEDIA_RADIUS } from "./cardMetrics.js";
|
|
9
|
+
const DIMMED_OPACITY = 0.6;
|
|
10
|
+
const Frame = ({ src, alt, fallbackText, quiet = false }) => {
|
|
11
|
+
const { colors } = useCustomTheme();
|
|
12
|
+
const ref = useRef(null);
|
|
13
|
+
const [loaded, setLoaded] = useState(false);
|
|
14
|
+
const [failed, setFailed] = useState(src === "");
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const el = ref.current;
|
|
17
|
+
if (el && el.complete && el.naturalWidth > 0)
|
|
18
|
+
setLoaded(true);
|
|
19
|
+
}, []);
|
|
20
|
+
if (failed) {
|
|
21
|
+
if (quiet)
|
|
22
|
+
return null;
|
|
23
|
+
return (_jsxs(Box, { role: "img", "aria-label": alt, position: "absolute", inset: 0, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: 1.5, color: colors.textMuted, bg: colors.background[100], children: [_jsx(ImageOff, { size: 24, "aria-hidden": true }), fallbackText ? (_jsx(Text, { as: "span", fontSize: "xs", fontWeight: 500, children: fallbackText })) : null] }));
|
|
24
|
+
}
|
|
25
|
+
return (_jsx(Box, { as: "img", ref: ref, src: src, alt: alt, loading: "lazy", decoding: "async", draggable: false, onLoad: () => setLoaded(true), onError: () => setFailed(true), position: "absolute", inset: 0, w: "100%", h: "100%", objectFit: "cover", display: "block", opacity: loaded ? 1 : 0, transition: transitionFor(["opacity"]), sx: reducedMotionSx() }));
|
|
26
|
+
};
|
|
27
|
+
/** Tonal media well: cover-fitted primary frame, optional hover frame, broken-image tile; overlays are children. */
|
|
28
|
+
const ProductCardMedia = ({ primary, hover, title, alt, aspectRatio, dimmed, selected, fallbackText, width, children, }) => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const { colors } = useCustomTheme();
|
|
31
|
+
return (_jsxs(Box, { "data-media": true, "data-ratio": aspectRatio, position: "relative", flexShrink: 0, w: width !== null && width !== void 0 ? width : "100%", sx: { aspectRatio: CSS_RATIO[aspectRatio] }, borderRadius: MEDIA_RADIUS, overflow: "hidden", bg: colors.background[100], boxShadow: selected ? `0 0 0 2px ${colors.header[900]}` : "none", transition: transitionFor(["box-shadow"]), children: [_jsx(Box, { "data-primary": true, position: "absolute", inset: 0, opacity: dimmed ? DIMMED_OPACITY : 1, transition: transitionFor(["transform", "opacity"], "base"), sx: reducedMotionSx(), children: primary ? (_jsx(Frame, { src: primary.src, alt: (_b = (_a = primary.alt) !== null && _a !== void 0 ? _a : alt) !== null && _b !== void 0 ? _b : title, fallbackText: fallbackText }, primary.src)) : (_jsx(Frame, { src: "", alt: alt !== null && alt !== void 0 ? alt : title, fallbackText: fallbackText }, "none")) }), hover ? (_jsx(Box, { "data-hover-frame": true, "aria-hidden": true, position: "absolute", inset: 0, opacity: 0, pointerEvents: "none", transition: transitionFor(["opacity"], "base"), sx: reducedMotionSx(), children: _jsx(Frame, { src: hover.src, alt: "", quiet: true }, hover.src) })) : null, children] }));
|
|
32
|
+
};
|
|
33
|
+
export default ProductCardMedia;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Flex, VisuallyHidden } from "@chakra-ui/react";
|
|
3
|
+
import Skeletons from "../Skeletons/Skeletons.js";
|
|
4
|
+
import { CSS_RATIO, DENSITY, MEDIA_RADIUS, TITLE_LINES } from "./cardMetrics.js";
|
|
5
|
+
/** Loading twin of ProductCard: same media ratio, title reservation and gaps, so the swap never moves the grid. */
|
|
6
|
+
const ProductCardSkeleton = ({ layout = "grid", density = "compact", aspectRatio = "4/5", "data-testid": testId, }) => {
|
|
7
|
+
const m = DENSITY[density];
|
|
8
|
+
const horizontal = layout === "list";
|
|
9
|
+
const rail = layout === "rail";
|
|
10
|
+
return (_jsxs(Flex, { "aria-busy": "true", "data-testid": testId, "data-layout": layout, direction: horizontal ? "row" : "column", gap: horizontal ? 3 : 0, w: rail ? m.railWidth : "100%", h: "100%", minW: 0, flexShrink: rail ? 0 : undefined, children: [_jsx(VisuallyHidden, { children: "Loading product" }), _jsx(Box, { flexShrink: 0, w: horizontal ? m.listMedia : "100%", borderRadius: MEDIA_RADIUS, overflow: "hidden", sx: { aspectRatio: CSS_RATIO[aspectRatio] }, children: _jsx(Skeletons, { type: "skeleton", height: "100%", width: "100%", borderRadius: MEDIA_RADIUS }) }), _jsxs(Flex, { direction: "column", flex: 1, minW: 0, gap: m.bodyGap, pt: horizontal ? 0 : m.bodyTop, "aria-hidden": true, children: [_jsx(Skeletons, { type: "skeleton", height: `${m.brand.line - 4}px`, width: "35%" }), _jsxs(Flex, { direction: "column", gap: "4px", minH: `${m.title.line * TITLE_LINES}px`, justify: "center", children: [_jsx(Skeletons, { type: "skeleton", height: `${m.title.line - 6}px`, width: "92%" }), _jsx(Skeletons, { type: "skeleton", height: `${m.title.line - 6}px`, width: "60%" })] }), _jsx(Skeletons, { type: "skeleton", height: "1rem", width: "45%" }), _jsx(Skeletons, { type: "skeleton", height: "1.25rem", width: "55%" })] })] }));
|
|
11
|
+
};
|
|
12
|
+
export default ProductCardSkeleton;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { Box, Flex, Text, VisuallyHidden } from "@chakra-ui/react";
|
|
4
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
5
|
+
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
6
|
+
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
7
|
+
import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
|
|
8
|
+
const TARGET = "1.5rem";
|
|
9
|
+
const UNAVAILABLE_OPACITY = 0.45;
|
|
10
|
+
/** Colour dots for the first swatch axis: hover or focus previews the image, a press keeps it. */
|
|
11
|
+
const ProductCardSwatches = ({ axis, limit, dot, activeId, soldOutIds, labels, onPreview, onPick }) => {
|
|
12
|
+
const { colors } = useCustomTheme();
|
|
13
|
+
const cells = useRef([]);
|
|
14
|
+
const shown = axis.values.slice(0, limit);
|
|
15
|
+
const rest = axis.values.length - shown.length;
|
|
16
|
+
const activeIndex = Math.max(0, shown.findIndex((value) => value.id === activeId));
|
|
17
|
+
const onKeyDown = (event) => {
|
|
18
|
+
var _a;
|
|
19
|
+
const step = event.key === "ArrowRight" || event.key === "ArrowDown" ? 1 : event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 0;
|
|
20
|
+
if (step === 0)
|
|
21
|
+
return;
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
const next = (activeIndex + step + shown.length) % shown.length;
|
|
24
|
+
onPick(shown[next].id);
|
|
25
|
+
(_a = cells.current[next]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
26
|
+
};
|
|
27
|
+
return (_jsxs(Flex, { "data-control": true, position: "relative", zIndex: 2, align: "center", minH: TARGET, ml: "-0.375rem", maxW: "100%", children: [_jsx(Flex, { role: "radiogroup", "aria-label": axis.label, onKeyDown: onKeyDown, onMouseLeave: () => onPreview(null), children: shown.map((value, index) => {
|
|
28
|
+
const selected = value.id === activeId;
|
|
29
|
+
const soldOut = soldOutIds.has(value.id);
|
|
30
|
+
return (_jsx(Box, { as: "button", type: "button", role: "radio", ref: (el) => {
|
|
31
|
+
cells.current[index] = el;
|
|
32
|
+
}, "aria-checked": selected, "aria-label": soldOut ? `${value.label}, ${labels.soldOut.toLowerCase()}` : value.label, tabIndex: index === activeIndex ? 0 : -1, title: value.label, onClick: () => onPick(value.id), onMouseEnter: () => onPreview(value.id), onFocus: () => onPreview(value.id), onBlur: () => onPreview(null), display: "inline-flex", alignItems: "center", justifyContent: "center", boxSize: TARGET, flexShrink: 0, borderRadius: "full", cursor: "pointer", sx: { outline: "none", ...focusVisibleStyles(colors) }, children: _jsx(Box, { as: "span", display: "inline-flex", p: "2px", borderWidth: "2px", borderStyle: "solid", borderRadius: "full", borderColor: selected ? colors.header[900] : "transparent", transition: transitionFor(["border-color"]), sx: reducedMotionSx(), children: _jsx(Box, { as: "span", display: "block", boxSize: `${dot}px`, borderRadius: "full", backgroundColor: value.swatch, opacity: soldOut ? UNAVAILABLE_OPACITY : 1, boxShadow: `inset 0 0 0 1px ${colors.boxborder[200]}` }) }) }, value.id));
|
|
33
|
+
}) }), rest > 0 ? (_jsxs(_Fragment, { children: [_jsxs(Text, { as: "span", "aria-hidden": true, ml: 1, fontSize: "0.75rem", fontWeight: 500, color: colors.textMuted, sx: { fontVariantNumeric: "tabular-nums" }, children: ["+", rest] }), _jsx(VisuallyHidden, { children: labels.moreColours(rest) })] })) : null] }));
|
|
34
|
+
};
|
|
35
|
+
export default ProductCardSwatches;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Box, Flex, Text } from "@chakra-ui/react";
|
|
4
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
5
|
+
import { formatPrice } from "../../Utils/price.js";
|
|
6
|
+
import Button from "../Button/Button.js";
|
|
7
|
+
import Drawer, { DrawerBody, DrawerFooter, DrawerHeader } from "../Drawer/Drawer.js";
|
|
8
|
+
import Modal, { ModalBody, ModalFooter } from "../Modal/Modal.js";
|
|
9
|
+
import PriceBlock from "../PriceBlock/PriceBlock.js";
|
|
10
|
+
import QuantityStepper from "../QuantityStepper/QuantityStepper.js";
|
|
11
|
+
import VariantSelector from "../VariantSelector/VariantSelector.js";
|
|
12
|
+
import { findVariant } from "../Commerce/commerceVariants.js";
|
|
13
|
+
import { rangeOf, firstMissingAxis } from "./productCardModel.js";
|
|
14
|
+
import { useMinWidth } from "./useMinWidth.js";
|
|
15
|
+
const DEFAULT_LABELS = {
|
|
16
|
+
heading: "Choose options",
|
|
17
|
+
quantity: "Quantity",
|
|
18
|
+
confirm: "Add to bag",
|
|
19
|
+
confirmWithTotal: (total) => `Add to bag — ${total}`,
|
|
20
|
+
prompt: (axisLabel) => `Select a ${axisLabel}`,
|
|
21
|
+
};
|
|
22
|
+
const DESKTOP_QUERY = "(min-width: 48em)";
|
|
23
|
+
/** Bottom sheet on phones, centred panel on desktop; holds the option picker so a card never grows. */
|
|
24
|
+
const QuickAddSheet = ({ isOpen, onClose, title, brand, media, axes, variants, defaultSelection, onConfirm, presentation = "auto", drawerContentProps, labels, currency, locale, "data-testid": testId, }) => {
|
|
25
|
+
var _a, _b, _c;
|
|
26
|
+
const { colors } = useCustomTheme();
|
|
27
|
+
const desktop = useMinWidth(DESKTOP_QUERY);
|
|
28
|
+
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
29
|
+
const [selection, setSelection] = useState(defaultSelection !== null && defaultSelection !== void 0 ? defaultSelection : {});
|
|
30
|
+
const [quantity, setQuantity] = useState(1);
|
|
31
|
+
const [error, setError] = useState();
|
|
32
|
+
const [wasOpen, setWasOpen] = useState(isOpen);
|
|
33
|
+
if (isOpen !== wasOpen) {
|
|
34
|
+
setWasOpen(isOpen);
|
|
35
|
+
if (isOpen) {
|
|
36
|
+
setSelection(defaultSelection !== null && defaultSelection !== void 0 ? defaultSelection : {});
|
|
37
|
+
setQuantity(1);
|
|
38
|
+
setError(undefined);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const fmt = { currency, locale };
|
|
42
|
+
const variant = findVariant(axes, variants, selection);
|
|
43
|
+
const range = rangeOf(variants);
|
|
44
|
+
const maxQuantity = (variant === null || variant === void 0 ? void 0 : variant.stock) !== undefined && variant.stock > 0 ? variant.stock : undefined;
|
|
45
|
+
const confirmLabel = variant ? copy.confirmWithTotal(formatPrice(variant.price * quantity, fmt)) : copy.confirm;
|
|
46
|
+
const onSelect = (next) => {
|
|
47
|
+
setSelection(next);
|
|
48
|
+
setError(undefined);
|
|
49
|
+
const nextVariant = findVariant(axes, variants, next);
|
|
50
|
+
if ((nextVariant === null || nextVariant === void 0 ? void 0 : nextVariant.stock) !== undefined && nextVariant.stock > 0)
|
|
51
|
+
setQuantity((q) => Math.min(q, nextVariant.stock));
|
|
52
|
+
};
|
|
53
|
+
const confirm = () => {
|
|
54
|
+
var _a;
|
|
55
|
+
if (!variant) {
|
|
56
|
+
const missing = firstMissingAxis(axes, selection);
|
|
57
|
+
setError(copy.prompt(((_a = missing === null || missing === void 0 ? void 0 : missing.label) !== null && _a !== void 0 ? _a : "option").toLowerCase()));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
onConfirm(variant, quantity);
|
|
61
|
+
};
|
|
62
|
+
const summary = (_jsxs(Flex, { align: "center", gap: 3, mb: 4, children: [media ? (_jsx(Box, { as: "img", src: (_a = media.thumb) !== null && _a !== void 0 ? _a : media.src, alt: "", boxSize: "4.5rem", flexShrink: 0, borderRadius: "xl", objectFit: "cover", bg: colors.background[100] })) : null, _jsxs(Flex, { direction: "column", gap: 0.5, minW: 0, children: [brand ? (_jsx(Text, { fontSize: "xs", color: colors.textMuted, noOfLines: 1, children: brand })) : null, _jsx(Text, { fontSize: "sm", fontWeight: 500, color: colors.header[900], noOfLines: 2, children: title }), _jsx(PriceBlock, { size: "sm", price: (_b = variant === null || variant === void 0 ? void 0 : variant.price) !== null && _b !== void 0 ? _b : (_c = variants[0]) === null || _c === void 0 ? void 0 : _c.price, mrp: variant === null || variant === void 0 ? void 0 : variant.mrp, priceRange: variant ? undefined : range, currency: currency, locale: locale })] })] }));
|
|
63
|
+
const body = (_jsxs(Flex, { direction: "column", gap: 5, "data-testid": testId, children: [summary, _jsx(VariantSelector, { axes: axes, variants: variants, value: selection, onValueChange: onSelect, error: error, showSelectedLabel: true, showLowStock: true }), _jsxs(Flex, { align: "center", justify: "space-between", gap: 3, children: [_jsx(Text, { as: "span", fontSize: "sm", fontWeight: 600, color: colors.header[900], children: copy.quantity }), _jsx(QuantityStepper, { value: quantity, min: 1, max: maxQuantity, onValueChange: setQuantity, itemLabel: title })] })] }));
|
|
64
|
+
const action = (_jsx(Button, { size: "lg", width: "100%", onClick: confirm, children: confirmLabel }));
|
|
65
|
+
const asModal = presentation === "modal" || (presentation === "auto" && desktop);
|
|
66
|
+
if (asModal) {
|
|
67
|
+
return (_jsxs(Modal, { size: "md", isOpen: isOpen, onClose: onClose, isCentered: true, title: copy.heading, children: [_jsx(ModalBody, { children: body }), _jsx(ModalFooter, { children: action })] }));
|
|
68
|
+
}
|
|
69
|
+
return (_jsxs(Drawer, { isOpen: isOpen, onClose: onClose, placement: "bottom", size: "md", contentProps: { maxW: "100%", w: "100%", maxH: "90vh", borderTopRadius: "2xl", overflow: "auto", ...drawerContentProps }, children: [_jsx(DrawerHeader, { children: copy.heading }), _jsx(DrawerBody, { children: body }), _jsx(DrawerFooter, { children: action })] }));
|
|
70
|
+
};
|
|
71
|
+
export default QuickAddSheet;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const DEFAULT_LABELS = {
|
|
2
|
+
save: (title) => `Save ${title}`,
|
|
3
|
+
chooseOptions: (title) => `Choose options for ${title}`,
|
|
4
|
+
addToBag: (title) => `Add to bag: ${title}`,
|
|
5
|
+
notifyMe: "Notify me",
|
|
6
|
+
notifyMeFor: (title) => `Notify me when ${title} is back`,
|
|
7
|
+
chooseOptionsText: "Choose options",
|
|
8
|
+
addToBagText: "Add to bag",
|
|
9
|
+
soldOut: "Sold out",
|
|
10
|
+
selected: "Selected",
|
|
11
|
+
moreColours: (count) => `${count} more colours`,
|
|
12
|
+
imageUnavailable: "Image unavailable",
|
|
13
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const DENSITY = {
|
|
2
|
+
compact: {
|
|
3
|
+
badgeInset: "0.5rem",
|
|
4
|
+
wishlistInset: "0",
|
|
5
|
+
actionInset: "0.25rem",
|
|
6
|
+
bodyTop: "0.5rem",
|
|
7
|
+
bodyGap: "1px",
|
|
8
|
+
brand: { size: "0.75rem", line: 16 },
|
|
9
|
+
title: { size: "0.8125rem", line: 18 },
|
|
10
|
+
price: "sm",
|
|
11
|
+
dot: 12,
|
|
12
|
+
railWidth: "9.75rem",
|
|
13
|
+
listMedia: "6rem",
|
|
14
|
+
rowGap: "1.5rem",
|
|
15
|
+
},
|
|
16
|
+
comfortable: {
|
|
17
|
+
badgeInset: "0.625rem",
|
|
18
|
+
wishlistInset: "0.125rem",
|
|
19
|
+
actionInset: "0.375rem",
|
|
20
|
+
bodyTop: "0.625rem",
|
|
21
|
+
bodyGap: "2px",
|
|
22
|
+
brand: { size: "0.75rem", line: 16 },
|
|
23
|
+
title: { size: "0.875rem", line: 20 },
|
|
24
|
+
price: "sm",
|
|
25
|
+
dot: 14,
|
|
26
|
+
railWidth: "12.5rem",
|
|
27
|
+
listMedia: "7rem",
|
|
28
|
+
rowGap: "1.5rem",
|
|
29
|
+
},
|
|
30
|
+
spacious: {
|
|
31
|
+
badgeInset: "0.75rem",
|
|
32
|
+
wishlistInset: "0.25rem",
|
|
33
|
+
actionInset: "0.5rem",
|
|
34
|
+
bodyTop: "0.75rem",
|
|
35
|
+
bodyGap: "3px",
|
|
36
|
+
brand: { size: "0.8125rem", line: 18 },
|
|
37
|
+
title: { size: "0.9375rem", line: 22 },
|
|
38
|
+
price: "md",
|
|
39
|
+
dot: 16,
|
|
40
|
+
railWidth: "12.5rem",
|
|
41
|
+
listMedia: "7rem",
|
|
42
|
+
rowGap: "2rem",
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
export const CSS_RATIO = {
|
|
46
|
+
"4/5": "4 / 5",
|
|
47
|
+
"1/1": "1 / 1",
|
|
48
|
+
"3/4": "3 / 4",
|
|
49
|
+
};
|
|
50
|
+
export const MEDIA_RADIUS = "1rem";
|
|
51
|
+
export const TITLE_LINES = 2;
|
|
52
|
+
export const FINE_POINTER = "@media (hover: hover) and (pointer: fine)";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export const jacketMedia = [
|
|
2
|
+
{ id: "indigo-front", src: "/p/indigo-front.webp", alt: "Jacket in indigo, front" },
|
|
3
|
+
{ id: "indigo-back", src: "/p/indigo-back.webp", alt: "Jacket in indigo, back" },
|
|
4
|
+
{ id: "ice-front", src: "/p/ice-front.webp", alt: "Jacket in ice blue, front" },
|
|
5
|
+
{ id: "ice-back", src: "/p/ice-back.webp", alt: "Jacket in ice blue, back" },
|
|
6
|
+
{ id: "black-front", src: "/p/black-front.webp", alt: "Jacket in black, front" },
|
|
7
|
+
{ id: "olive-front", src: "/p/olive-front.webp", alt: "Jacket in olive, front" },
|
|
8
|
+
];
|
|
9
|
+
export const jacketAxes = [
|
|
10
|
+
{
|
|
11
|
+
id: "colour",
|
|
12
|
+
label: "Colour",
|
|
13
|
+
type: "swatch",
|
|
14
|
+
values: [
|
|
15
|
+
{ id: "indigo", label: "Indigo Wash", swatch: "steelblue" },
|
|
16
|
+
{ id: "ice", label: "Ice Blue", swatch: "lightsteelblue" },
|
|
17
|
+
{ id: "black", label: "Washed Black", swatch: "black" },
|
|
18
|
+
{ id: "olive", label: "Olive", swatch: "olive" },
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "size",
|
|
23
|
+
label: "Size",
|
|
24
|
+
type: "chip",
|
|
25
|
+
values: [
|
|
26
|
+
{ id: "m", label: "M" },
|
|
27
|
+
{ id: "l", label: "L" },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
const sized = (colour, size, stock) => ({
|
|
32
|
+
id: `jacket-${colour}-${size}`,
|
|
33
|
+
options: { colour, size },
|
|
34
|
+
price: 3499,
|
|
35
|
+
mrp: 4999,
|
|
36
|
+
stock,
|
|
37
|
+
});
|
|
38
|
+
export const jacketVariants = [
|
|
39
|
+
sized("indigo", "m", 10),
|
|
40
|
+
sized("indigo", "l", 4),
|
|
41
|
+
sized("ice", "m", 9),
|
|
42
|
+
sized("ice", "l", 9),
|
|
43
|
+
sized("black", "m", 0),
|
|
44
|
+
sized("black", "l", 0),
|
|
45
|
+
sized("olive", "m", 6),
|
|
46
|
+
sized("olive", "l", 6),
|
|
47
|
+
];
|
|
48
|
+
export const jacketMediaIds = {
|
|
49
|
+
"colour:indigo": ["indigo-front", "indigo-back"],
|
|
50
|
+
"colour:ice": ["ice-front", "ice-back"],
|
|
51
|
+
"colour:black": ["black-front"],
|
|
52
|
+
"colour:olive": ["olive-front"],
|
|
53
|
+
};
|
|
54
|
+
export const mugMedia = [
|
|
55
|
+
{ id: "front", src: "/p/mug.webp", alt: "Mug, front" },
|
|
56
|
+
{ id: "detail", src: "/p/mug-d.webp", alt: "Mug, glaze close-up" },
|
|
57
|
+
];
|
|
58
|
+
export const mugVariants = [{ id: "mug-default", options: {}, price: 699, stock: 46 }];
|