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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("@chakra-ui/react");
|
|
8
|
+
const Skeletons_1 = __importDefault(require("../Skeletons/Skeletons"));
|
|
9
|
+
const cardMetrics_1 = require("./cardMetrics");
|
|
10
|
+
/** Loading twin of ProductCard: same media ratio, title reservation and gaps, so the swap never moves the grid. */
|
|
11
|
+
const ProductCardSkeleton = ({ layout = "grid", density = "compact", aspectRatio = "4/5", "data-testid": testId, }) => {
|
|
12
|
+
const m = cardMetrics_1.DENSITY[density];
|
|
13
|
+
const horizontal = layout === "list";
|
|
14
|
+
const rail = layout === "rail";
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.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: [(0, jsx_runtime_1.jsx)(react_1.VisuallyHidden, { children: "Loading product" }), (0, jsx_runtime_1.jsx)(react_1.Box, { flexShrink: 0, w: horizontal ? m.listMedia : "100%", borderRadius: cardMetrics_1.MEDIA_RADIUS, overflow: "hidden", sx: { aspectRatio: cardMetrics_1.CSS_RATIO[aspectRatio] }, children: (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "100%", width: "100%", borderRadius: cardMetrics_1.MEDIA_RADIUS }) }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { direction: "column", flex: 1, minW: 0, gap: m.bodyGap, pt: horizontal ? 0 : m.bodyTop, "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: `${m.brand.line - 4}px`, width: "35%" }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { direction: "column", gap: "4px", minH: `${m.title.line * cardMetrics_1.TITLE_LINES}px`, justify: "center", children: [(0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: `${m.title.line - 6}px`, width: "92%" }), (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: `${m.title.line - 6}px`, width: "60%" })] }), (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "1rem", width: "45%" }), (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: "1.25rem", width: "55%" })] })] }));
|
|
16
|
+
};
|
|
17
|
+
exports.default = ProductCardSkeleton;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { OptionAxis } from "../Commerce/commerceTypes";
|
|
2
|
+
import type { ProductCardLabels } from "./ProductCardProps";
|
|
3
|
+
type ProductCardSwatchesProps = {
|
|
4
|
+
axis: OptionAxis;
|
|
5
|
+
limit: number;
|
|
6
|
+
dot: number;
|
|
7
|
+
activeId: string;
|
|
8
|
+
soldOutIds: ReadonlySet<string>;
|
|
9
|
+
labels: ProductCardLabels;
|
|
10
|
+
onPreview: (valueId: string | null) => void;
|
|
11
|
+
onPick: (valueId: string) => void;
|
|
12
|
+
};
|
|
13
|
+
/** Colour dots for the first swatch axis: hover or focus previews the image, a press keeps it. */
|
|
14
|
+
declare const ProductCardSwatches: ({ axis, limit, dot, activeId, soldOutIds, labels, onPreview, onPick }: ProductCardSwatchesProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default ProductCardSwatches;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_2 = require("@chakra-ui/react");
|
|
6
|
+
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
7
|
+
const motion_1 = require("../../Theme/tokens/primitives/motion");
|
|
8
|
+
const motion_2 = require("../../Theme/chakra/motion");
|
|
9
|
+
const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
|
|
10
|
+
const TARGET = "1.5rem";
|
|
11
|
+
const UNAVAILABLE_OPACITY = 0.45;
|
|
12
|
+
/** Colour dots for the first swatch axis: hover or focus previews the image, a press keeps it. */
|
|
13
|
+
const ProductCardSwatches = ({ axis, limit, dot, activeId, soldOutIds, labels, onPreview, onPick }) => {
|
|
14
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
15
|
+
const cells = (0, react_1.useRef)([]);
|
|
16
|
+
const shown = axis.values.slice(0, limit);
|
|
17
|
+
const rest = axis.values.length - shown.length;
|
|
18
|
+
const activeIndex = Math.max(0, shown.findIndex((value) => value.id === activeId));
|
|
19
|
+
const onKeyDown = (event) => {
|
|
20
|
+
var _a;
|
|
21
|
+
const step = event.key === "ArrowRight" || event.key === "ArrowDown" ? 1 : event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 0;
|
|
22
|
+
if (step === 0)
|
|
23
|
+
return;
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
const next = (activeIndex + step + shown.length) % shown.length;
|
|
26
|
+
onPick(shown[next].id);
|
|
27
|
+
(_a = cells.current[next]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
28
|
+
};
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { "data-control": true, position: "relative", zIndex: 2, align: "center", minH: TARGET, ml: "-0.375rem", maxW: "100%", children: [(0, jsx_runtime_1.jsx)(react_2.Flex, { role: "radiogroup", "aria-label": axis.label, onKeyDown: onKeyDown, onMouseLeave: () => onPreview(null), children: shown.map((value, index) => {
|
|
30
|
+
const selected = value.id === activeId;
|
|
31
|
+
const soldOut = soldOutIds.has(value.id);
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "button", type: "button", role: "radio", ref: (el) => {
|
|
33
|
+
cells.current[index] = el;
|
|
34
|
+
}, "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", ...(0, focusRing_styles_1.focusVisibleStyles)(colors) }, children: (0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-flex", p: "2px", borderWidth: "2px", borderStyle: "solid", borderRadius: "full", borderColor: selected ? colors.header[900] : "transparent", transition: (0, motion_1.transitionFor)(["border-color"]), sx: (0, motion_2.reducedMotionSx)(), children: (0, jsx_runtime_1.jsx)(react_2.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));
|
|
35
|
+
}) }), rest > 0 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.Text, { as: "span", "aria-hidden": true, ml: 1, fontSize: "0.75rem", fontWeight: 500, color: colors.textMuted, sx: { fontVariantNumeric: "tabular-nums" }, children: ["+", rest] }), (0, jsx_runtime_1.jsx)(react_2.VisuallyHidden, { children: labels.moreColours(rest) })] })) : null] }));
|
|
36
|
+
};
|
|
37
|
+
exports.default = ProductCardSwatches;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { QuickAddSheetProps } from "./QuickAddSheetProps";
|
|
2
|
+
/** Bottom sheet on phones, centred panel on desktop; holds the option picker so a card never grows. */
|
|
3
|
+
declare const QuickAddSheet: ({ isOpen, onClose, title, brand, media, axes, variants, defaultSelection, onConfirm, presentation, drawerContentProps, labels, currency, locale, "data-testid": testId, }: QuickAddSheetProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default QuickAddSheet;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
40
|
+
const react_1 = require("react");
|
|
41
|
+
const react_2 = require("@chakra-ui/react");
|
|
42
|
+
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
43
|
+
const price_1 = require("../../Utils/price");
|
|
44
|
+
const Button_1 = __importDefault(require("../Button/Button"));
|
|
45
|
+
const Drawer_1 = __importStar(require("../Drawer/Drawer"));
|
|
46
|
+
const Modal_1 = __importStar(require("../Modal/Modal"));
|
|
47
|
+
const PriceBlock_1 = __importDefault(require("../PriceBlock/PriceBlock"));
|
|
48
|
+
const QuantityStepper_1 = __importDefault(require("../QuantityStepper/QuantityStepper"));
|
|
49
|
+
const VariantSelector_1 = __importDefault(require("../VariantSelector/VariantSelector"));
|
|
50
|
+
const commerceVariants_1 = require("../Commerce/commerceVariants");
|
|
51
|
+
const productCardModel_1 = require("./productCardModel");
|
|
52
|
+
const useMinWidth_1 = require("./useMinWidth");
|
|
53
|
+
const DEFAULT_LABELS = {
|
|
54
|
+
heading: "Choose options",
|
|
55
|
+
quantity: "Quantity",
|
|
56
|
+
confirm: "Add to bag",
|
|
57
|
+
confirmWithTotal: (total) => `Add to bag — ${total}`,
|
|
58
|
+
prompt: (axisLabel) => `Select a ${axisLabel}`,
|
|
59
|
+
};
|
|
60
|
+
const DESKTOP_QUERY = "(min-width: 48em)";
|
|
61
|
+
/** Bottom sheet on phones, centred panel on desktop; holds the option picker so a card never grows. */
|
|
62
|
+
const QuickAddSheet = ({ isOpen, onClose, title, brand, media, axes, variants, defaultSelection, onConfirm, presentation = "auto", drawerContentProps, labels, currency, locale, "data-testid": testId, }) => {
|
|
63
|
+
var _a, _b, _c;
|
|
64
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
65
|
+
const desktop = (0, useMinWidth_1.useMinWidth)(DESKTOP_QUERY);
|
|
66
|
+
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
67
|
+
const [selection, setSelection] = (0, react_1.useState)(defaultSelection !== null && defaultSelection !== void 0 ? defaultSelection : {});
|
|
68
|
+
const [quantity, setQuantity] = (0, react_1.useState)(1);
|
|
69
|
+
const [error, setError] = (0, react_1.useState)();
|
|
70
|
+
const [wasOpen, setWasOpen] = (0, react_1.useState)(isOpen);
|
|
71
|
+
if (isOpen !== wasOpen) {
|
|
72
|
+
setWasOpen(isOpen);
|
|
73
|
+
if (isOpen) {
|
|
74
|
+
setSelection(defaultSelection !== null && defaultSelection !== void 0 ? defaultSelection : {});
|
|
75
|
+
setQuantity(1);
|
|
76
|
+
setError(undefined);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const fmt = { currency, locale };
|
|
80
|
+
const variant = (0, commerceVariants_1.findVariant)(axes, variants, selection);
|
|
81
|
+
const range = (0, productCardModel_1.rangeOf)(variants);
|
|
82
|
+
const maxQuantity = (variant === null || variant === void 0 ? void 0 : variant.stock) !== undefined && variant.stock > 0 ? variant.stock : undefined;
|
|
83
|
+
const confirmLabel = variant ? copy.confirmWithTotal((0, price_1.formatPrice)(variant.price * quantity, fmt)) : copy.confirm;
|
|
84
|
+
const onSelect = (next) => {
|
|
85
|
+
setSelection(next);
|
|
86
|
+
setError(undefined);
|
|
87
|
+
const nextVariant = (0, commerceVariants_1.findVariant)(axes, variants, next);
|
|
88
|
+
if ((nextVariant === null || nextVariant === void 0 ? void 0 : nextVariant.stock) !== undefined && nextVariant.stock > 0)
|
|
89
|
+
setQuantity((q) => Math.min(q, nextVariant.stock));
|
|
90
|
+
};
|
|
91
|
+
const confirm = () => {
|
|
92
|
+
var _a;
|
|
93
|
+
if (!variant) {
|
|
94
|
+
const missing = (0, productCardModel_1.firstMissingAxis)(axes, selection);
|
|
95
|
+
setError(copy.prompt(((_a = missing === null || missing === void 0 ? void 0 : missing.label) !== null && _a !== void 0 ? _a : "option").toLowerCase()));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
onConfirm(variant, quantity);
|
|
99
|
+
};
|
|
100
|
+
const summary = ((0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 3, mb: 4, children: [media ? ((0, jsx_runtime_1.jsx)(react_2.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, (0, jsx_runtime_1.jsxs)(react_2.Flex, { direction: "column", gap: 0.5, minW: 0, children: [brand ? ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "xs", color: colors.textMuted, noOfLines: 1, children: brand })) : null, (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "sm", fontWeight: 500, color: colors.header[900], noOfLines: 2, children: title }), (0, jsx_runtime_1.jsx)(PriceBlock_1.default, { 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 })] })] }));
|
|
101
|
+
const body = ((0, jsx_runtime_1.jsxs)(react_2.Flex, { direction: "column", gap: 5, "data-testid": testId, children: [summary, (0, jsx_runtime_1.jsx)(VariantSelector_1.default, { axes: axes, variants: variants, value: selection, onValueChange: onSelect, error: error, showSelectedLabel: true, showLowStock: true }), (0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", justify: "space-between", gap: 3, children: [(0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", fontSize: "sm", fontWeight: 600, color: colors.header[900], children: copy.quantity }), (0, jsx_runtime_1.jsx)(QuantityStepper_1.default, { value: quantity, min: 1, max: maxQuantity, onValueChange: setQuantity, itemLabel: title })] })] }));
|
|
102
|
+
const action = ((0, jsx_runtime_1.jsx)(Button_1.default, { size: "lg", width: "100%", onClick: confirm, children: confirmLabel }));
|
|
103
|
+
const asModal = presentation === "modal" || (presentation === "auto" && desktop);
|
|
104
|
+
if (asModal) {
|
|
105
|
+
return ((0, jsx_runtime_1.jsxs)(Modal_1.default, { size: "md", isOpen: isOpen, onClose: onClose, isCentered: true, title: copy.heading, children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalBody, { children: body }), (0, jsx_runtime_1.jsx)(Modal_1.ModalFooter, { children: action })] }));
|
|
106
|
+
}
|
|
107
|
+
return ((0, jsx_runtime_1.jsxs)(Drawer_1.default, { isOpen: isOpen, onClose: onClose, placement: "bottom", size: "md", contentProps: { maxW: "100%", w: "100%", maxH: "90vh", borderTopRadius: "2xl", overflow: "auto", ...drawerContentProps }, children: [(0, jsx_runtime_1.jsx)(Drawer_1.DrawerHeader, { children: copy.heading }), (0, jsx_runtime_1.jsx)(Drawer_1.DrawerBody, { children: body }), (0, jsx_runtime_1.jsx)(Drawer_1.DrawerFooter, { children: action })] }));
|
|
108
|
+
};
|
|
109
|
+
exports.default = QuickAddSheet;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DrawerContentProps } from "@chakra-ui/react";
|
|
2
|
+
import type { OptionAxis, PriceFormat, ProductMedia, ProductVariant, VariantSelection } from "../Commerce/commerceTypes";
|
|
3
|
+
/** Visible copy of the sheet; override every string for another language. */
|
|
4
|
+
export interface QuickAddSheetLabels {
|
|
5
|
+
/** Sheet heading, which also names the dialog. */
|
|
6
|
+
heading: string;
|
|
7
|
+
/** Label of the quantity stepper row. */
|
|
8
|
+
quantity: string;
|
|
9
|
+
/** Confirm button text while no variant is chosen. */
|
|
10
|
+
confirm: string;
|
|
11
|
+
/** Confirm button text for a chosen variant, given the formatted total. */
|
|
12
|
+
confirmWithTotal: (total: string) => string;
|
|
13
|
+
/** Prompt shown when confirming with an axis unpicked, given the lower-cased axis label ("size"). */
|
|
14
|
+
prompt: (axisLabel: string) => string;
|
|
15
|
+
}
|
|
16
|
+
/** drawer slides up from the bottom edge, modal is a centred panel, auto picks modal from 48em up. */
|
|
17
|
+
export type QuickAddPresentation = "auto" | "drawer" | "modal";
|
|
18
|
+
/** Option picker shown before an add: the product, a `VariantSelector`, a quantity stepper and a confirm button naming the total. */
|
|
19
|
+
export interface QuickAddSheetProps extends PriceFormat {
|
|
20
|
+
isOpen: boolean;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
title: string;
|
|
23
|
+
brand?: string;
|
|
24
|
+
/** Thumbnail beside the title. */
|
|
25
|
+
media?: ProductMedia;
|
|
26
|
+
axes: OptionAxis[];
|
|
27
|
+
/** Availability and the confirm total are derived from these. */
|
|
28
|
+
variants: ProductVariant[];
|
|
29
|
+
/** Picks to start from each time the sheet opens, e.g. the colour already chosen on the card. */
|
|
30
|
+
defaultSelection?: VariantSelection;
|
|
31
|
+
/** Fires with the chosen variant and quantity; the sheet does not close itself. */
|
|
32
|
+
onConfirm: (variant: ProductVariant, quantity: number) => void;
|
|
33
|
+
presentation?: QuickAddPresentation;
|
|
34
|
+
/** Merged over the drawer panel defaults, e.g. `{ maxW: "390px !important", mx: "auto" }` inside a phone-width frame; the slide sets an inline max-width. */
|
|
35
|
+
drawerContentProps?: DrawerContentProps;
|
|
36
|
+
labels?: Partial<QuickAddSheetLabels>;
|
|
37
|
+
"data-testid"?: string;
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_LABELS = void 0;
|
|
4
|
+
exports.DEFAULT_LABELS = {
|
|
5
|
+
save: (title) => `Save ${title}`,
|
|
6
|
+
chooseOptions: (title) => `Choose options for ${title}`,
|
|
7
|
+
addToBag: (title) => `Add to bag: ${title}`,
|
|
8
|
+
notifyMe: "Notify me",
|
|
9
|
+
notifyMeFor: (title) => `Notify me when ${title} is back`,
|
|
10
|
+
chooseOptionsText: "Choose options",
|
|
11
|
+
addToBagText: "Add to bag",
|
|
12
|
+
soldOut: "Sold out",
|
|
13
|
+
selected: "Selected",
|
|
14
|
+
moreColours: (count) => `${count} more colours`,
|
|
15
|
+
imageUnavailable: "Image unavailable",
|
|
16
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ProductCardAspectRatio, ProductCardDensity } from "./ProductCardProps";
|
|
2
|
+
import type { PriceBlockSize } from "../PriceBlock/PriceBlockProps";
|
|
3
|
+
export type DensityMetrics = {
|
|
4
|
+
badgeInset: string;
|
|
5
|
+
wishlistInset: string;
|
|
6
|
+
actionInset: string;
|
|
7
|
+
bodyTop: string;
|
|
8
|
+
bodyGap: string;
|
|
9
|
+
brand: {
|
|
10
|
+
size: string;
|
|
11
|
+
line: number;
|
|
12
|
+
};
|
|
13
|
+
title: {
|
|
14
|
+
size: string;
|
|
15
|
+
line: number;
|
|
16
|
+
};
|
|
17
|
+
price: PriceBlockSize;
|
|
18
|
+
dot: number;
|
|
19
|
+
railWidth: string;
|
|
20
|
+
listMedia: string;
|
|
21
|
+
rowGap: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const DENSITY: Record<ProductCardDensity, DensityMetrics>;
|
|
24
|
+
export declare const CSS_RATIO: Record<ProductCardAspectRatio, string>;
|
|
25
|
+
export declare const MEDIA_RADIUS = "1rem";
|
|
26
|
+
export declare const TITLE_LINES = 2;
|
|
27
|
+
export declare const FINE_POINTER = "@media (hover: hover) and (pointer: fine)";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FINE_POINTER = exports.TITLE_LINES = exports.MEDIA_RADIUS = exports.CSS_RATIO = exports.DENSITY = void 0;
|
|
4
|
+
exports.DENSITY = {
|
|
5
|
+
compact: {
|
|
6
|
+
badgeInset: "0.5rem",
|
|
7
|
+
wishlistInset: "0",
|
|
8
|
+
actionInset: "0.25rem",
|
|
9
|
+
bodyTop: "0.5rem",
|
|
10
|
+
bodyGap: "1px",
|
|
11
|
+
brand: { size: "0.75rem", line: 16 },
|
|
12
|
+
title: { size: "0.8125rem", line: 18 },
|
|
13
|
+
price: "sm",
|
|
14
|
+
dot: 12,
|
|
15
|
+
railWidth: "9.75rem",
|
|
16
|
+
listMedia: "6rem",
|
|
17
|
+
rowGap: "1.5rem",
|
|
18
|
+
},
|
|
19
|
+
comfortable: {
|
|
20
|
+
badgeInset: "0.625rem",
|
|
21
|
+
wishlistInset: "0.125rem",
|
|
22
|
+
actionInset: "0.375rem",
|
|
23
|
+
bodyTop: "0.625rem",
|
|
24
|
+
bodyGap: "2px",
|
|
25
|
+
brand: { size: "0.75rem", line: 16 },
|
|
26
|
+
title: { size: "0.875rem", line: 20 },
|
|
27
|
+
price: "sm",
|
|
28
|
+
dot: 14,
|
|
29
|
+
railWidth: "12.5rem",
|
|
30
|
+
listMedia: "7rem",
|
|
31
|
+
rowGap: "1.5rem",
|
|
32
|
+
},
|
|
33
|
+
spacious: {
|
|
34
|
+
badgeInset: "0.75rem",
|
|
35
|
+
wishlistInset: "0.25rem",
|
|
36
|
+
actionInset: "0.5rem",
|
|
37
|
+
bodyTop: "0.75rem",
|
|
38
|
+
bodyGap: "3px",
|
|
39
|
+
brand: { size: "0.8125rem", line: 18 },
|
|
40
|
+
title: { size: "0.9375rem", line: 22 },
|
|
41
|
+
price: "md",
|
|
42
|
+
dot: 16,
|
|
43
|
+
railWidth: "12.5rem",
|
|
44
|
+
listMedia: "7rem",
|
|
45
|
+
rowGap: "2rem",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
exports.CSS_RATIO = {
|
|
49
|
+
"4/5": "4 / 5",
|
|
50
|
+
"1/1": "1 / 1",
|
|
51
|
+
"3/4": "3 / 4",
|
|
52
|
+
};
|
|
53
|
+
exports.MEDIA_RADIUS = "1rem";
|
|
54
|
+
exports.TITLE_LINES = 2;
|
|
55
|
+
exports.FINE_POINTER = "@media (hover: hover) and (pointer: fine)";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OptionAxis, ProductMedia, ProductVariant } from "../Commerce/commerceTypes";
|
|
2
|
+
export declare const jacketMedia: ProductMedia[];
|
|
3
|
+
export declare const jacketAxes: OptionAxis[];
|
|
4
|
+
export declare const jacketVariants: ProductVariant[];
|
|
5
|
+
export declare const jacketMediaIds: Record<string, string[]>;
|
|
6
|
+
export declare const mugMedia: ProductMedia[];
|
|
7
|
+
export declare const mugVariants: ProductVariant[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mugVariants = exports.mugMedia = exports.jacketMediaIds = exports.jacketVariants = exports.jacketAxes = exports.jacketMedia = void 0;
|
|
4
|
+
exports.jacketMedia = [
|
|
5
|
+
{ id: "indigo-front", src: "/p/indigo-front.webp", alt: "Jacket in indigo, front" },
|
|
6
|
+
{ id: "indigo-back", src: "/p/indigo-back.webp", alt: "Jacket in indigo, back" },
|
|
7
|
+
{ id: "ice-front", src: "/p/ice-front.webp", alt: "Jacket in ice blue, front" },
|
|
8
|
+
{ id: "ice-back", src: "/p/ice-back.webp", alt: "Jacket in ice blue, back" },
|
|
9
|
+
{ id: "black-front", src: "/p/black-front.webp", alt: "Jacket in black, front" },
|
|
10
|
+
{ id: "olive-front", src: "/p/olive-front.webp", alt: "Jacket in olive, front" },
|
|
11
|
+
];
|
|
12
|
+
exports.jacketAxes = [
|
|
13
|
+
{
|
|
14
|
+
id: "colour",
|
|
15
|
+
label: "Colour",
|
|
16
|
+
type: "swatch",
|
|
17
|
+
values: [
|
|
18
|
+
{ id: "indigo", label: "Indigo Wash", swatch: "steelblue" },
|
|
19
|
+
{ id: "ice", label: "Ice Blue", swatch: "lightsteelblue" },
|
|
20
|
+
{ id: "black", label: "Washed Black", swatch: "black" },
|
|
21
|
+
{ id: "olive", label: "Olive", swatch: "olive" },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "size",
|
|
26
|
+
label: "Size",
|
|
27
|
+
type: "chip",
|
|
28
|
+
values: [
|
|
29
|
+
{ id: "m", label: "M" },
|
|
30
|
+
{ id: "l", label: "L" },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
const sized = (colour, size, stock) => ({
|
|
35
|
+
id: `jacket-${colour}-${size}`,
|
|
36
|
+
options: { colour, size },
|
|
37
|
+
price: 3499,
|
|
38
|
+
mrp: 4999,
|
|
39
|
+
stock,
|
|
40
|
+
});
|
|
41
|
+
exports.jacketVariants = [
|
|
42
|
+
sized("indigo", "m", 10),
|
|
43
|
+
sized("indigo", "l", 4),
|
|
44
|
+
sized("ice", "m", 9),
|
|
45
|
+
sized("ice", "l", 9),
|
|
46
|
+
sized("black", "m", 0),
|
|
47
|
+
sized("black", "l", 0),
|
|
48
|
+
sized("olive", "m", 6),
|
|
49
|
+
sized("olive", "l", 6),
|
|
50
|
+
];
|
|
51
|
+
exports.jacketMediaIds = {
|
|
52
|
+
"colour:indigo": ["indigo-front", "indigo-back"],
|
|
53
|
+
"colour:ice": ["ice-front", "ice-back"],
|
|
54
|
+
"colour:black": ["black-front"],
|
|
55
|
+
"colour:olive": ["olive-front"],
|
|
56
|
+
};
|
|
57
|
+
exports.mugMedia = [
|
|
58
|
+
{ id: "front", src: "/p/mug.webp", alt: "Mug, front" },
|
|
59
|
+
{ id: "detail", src: "/p/mug-d.webp", alt: "Mug, glaze close-up" },
|
|
60
|
+
];
|
|
61
|
+
exports.mugVariants = [{ id: "mug-default", options: {}, price: 699, stock: 46 }];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { OptionAxis, ProductMedia, ProductVariant, VariantSelection } from "../Commerce/commerceTypes";
|
|
2
|
+
import type { ProductCardAction } from "./ProductCardProps";
|
|
3
|
+
export declare const DEFAULT_SWATCH_LIMIT = 3;
|
|
4
|
+
export declare const hasChoice: (axes: OptionAxis[]) => boolean;
|
|
5
|
+
/** The first colour-like axis whose values all carry a swatch; the card draws dots only for this one. */
|
|
6
|
+
export declare const swatchAxisOf: (axes: OptionAxis[]) => OptionAxis | undefined;
|
|
7
|
+
/** The one variant a product without a real choice resolves to, when there is one. */
|
|
8
|
+
export declare const soleVariantOf: (axes: OptionAxis[], variants: ProductVariant[]) => ProductVariant | undefined;
|
|
9
|
+
export declare const isSoldOut: (outOfStock: boolean | undefined, stock: number | undefined, variants: ProductVariant[]) => boolean;
|
|
10
|
+
/** Units left, only when a real count says the product is low; undefined otherwise. */
|
|
11
|
+
export declare const lowStockCount: (stock: number | undefined, sole: ProductVariant | undefined) => number | undefined;
|
|
12
|
+
export declare const deriveAction: (override: ProductCardAction | undefined, soldOut: boolean, axes: OptionAxis[]) => ProductCardAction;
|
|
13
|
+
/** Frames for the active swatch value: its mapped media, else the whole pool. */
|
|
14
|
+
export declare const framesFor: (media: ProductMedia[], mediaIdsByOption: Record<string, string[]> | undefined, axisId: string | undefined, valueId: string | undefined) => ProductMedia[];
|
|
15
|
+
/** Variants that share the picked colour, so the price range follows the dot. */
|
|
16
|
+
export declare const variantsFor: (variants: ProductVariant[], axisId: string | undefined, valueId: string | undefined) => ProductVariant[];
|
|
17
|
+
export declare const rangeOf: (variants: ProductVariant[]) => {
|
|
18
|
+
min: number;
|
|
19
|
+
max: number;
|
|
20
|
+
} | undefined;
|
|
21
|
+
export declare const valueSoldOut: (variants: ProductVariant[], axisId: string, valueId: string) => boolean;
|
|
22
|
+
export declare const firstMissingAxis: (axes: OptionAxis[], selection: VariantSelection) => OptionAxis | undefined;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.firstMissingAxis = exports.valueSoldOut = exports.rangeOf = exports.variantsFor = exports.framesFor = exports.deriveAction = exports.lowStockCount = exports.isSoldOut = exports.soleVariantOf = exports.swatchAxisOf = exports.hasChoice = exports.DEFAULT_SWATCH_LIMIT = void 0;
|
|
4
|
+
const commerceVariants_1 = require("../Commerce/commerceVariants");
|
|
5
|
+
exports.DEFAULT_SWATCH_LIMIT = 3;
|
|
6
|
+
const hasChoice = (axes) => axes.some((axis) => axis.values.length > 1);
|
|
7
|
+
exports.hasChoice = hasChoice;
|
|
8
|
+
/** The first colour-like axis whose values all carry a swatch; the card draws dots only for this one. */
|
|
9
|
+
const swatchAxisOf = (axes) => axes.find((axis) => (axis.type === "swatch" || axis.type === "image-tile") &&
|
|
10
|
+
axis.values.length > 1 &&
|
|
11
|
+
axis.values.every((value) => value.swatch));
|
|
12
|
+
exports.swatchAxisOf = swatchAxisOf;
|
|
13
|
+
/** The one variant a product without a real choice resolves to, when there is one. */
|
|
14
|
+
const soleVariantOf = (axes, variants) => {
|
|
15
|
+
var _a;
|
|
16
|
+
if ((0, exports.hasChoice)(axes))
|
|
17
|
+
return undefined;
|
|
18
|
+
const selection = {};
|
|
19
|
+
axes.forEach((axis) => {
|
|
20
|
+
if (axis.values[0])
|
|
21
|
+
selection[axis.id] = axis.values[0].id;
|
|
22
|
+
});
|
|
23
|
+
return (_a = (0, commerceVariants_1.findVariant)(axes, variants, selection)) !== null && _a !== void 0 ? _a : (axes.length === 0 ? variants[0] : undefined);
|
|
24
|
+
};
|
|
25
|
+
exports.soleVariantOf = soleVariantOf;
|
|
26
|
+
const isSoldOut = (outOfStock, stock, variants) => {
|
|
27
|
+
if (outOfStock !== undefined)
|
|
28
|
+
return outOfStock;
|
|
29
|
+
if (stock !== undefined)
|
|
30
|
+
return stock <= 0;
|
|
31
|
+
return variants.length > 0 && variants.every((variant) => (0, commerceVariants_1.stockState)(variant) === "out-of-stock");
|
|
32
|
+
};
|
|
33
|
+
exports.isSoldOut = isSoldOut;
|
|
34
|
+
/** Units left, only when a real count says the product is low; undefined otherwise. */
|
|
35
|
+
const lowStockCount = (stock, sole) => {
|
|
36
|
+
const count = stock !== null && stock !== void 0 ? stock : sole === null || sole === void 0 ? void 0 : sole.stock;
|
|
37
|
+
if (count === undefined)
|
|
38
|
+
return undefined;
|
|
39
|
+
const state = (0, commerceVariants_1.stockState)({ stock: count, backorder: sole === null || sole === void 0 ? void 0 : sole.backorder });
|
|
40
|
+
return state === "low-stock" ? count : undefined;
|
|
41
|
+
};
|
|
42
|
+
exports.lowStockCount = lowStockCount;
|
|
43
|
+
const deriveAction = (override, soldOut, axes) => {
|
|
44
|
+
if (override)
|
|
45
|
+
return override;
|
|
46
|
+
if (soldOut)
|
|
47
|
+
return "notify";
|
|
48
|
+
return (0, exports.hasChoice)(axes) ? "options" : "add";
|
|
49
|
+
};
|
|
50
|
+
exports.deriveAction = deriveAction;
|
|
51
|
+
const optionKey = (axisId, valueId) => `${axisId}:${valueId}`;
|
|
52
|
+
/** Frames for the active swatch value: its mapped media, else the whole pool. */
|
|
53
|
+
const framesFor = (media, mediaIdsByOption, axisId, valueId) => {
|
|
54
|
+
if (!axisId || !valueId || !mediaIdsByOption)
|
|
55
|
+
return media;
|
|
56
|
+
const ids = mediaIdsByOption[optionKey(axisId, valueId)];
|
|
57
|
+
if (!ids)
|
|
58
|
+
return media;
|
|
59
|
+
const frames = ids.map((id) => media.find((item) => item.id === id)).filter((item) => !!item);
|
|
60
|
+
return frames.length > 0 ? frames : media;
|
|
61
|
+
};
|
|
62
|
+
exports.framesFor = framesFor;
|
|
63
|
+
/** Variants that share the picked colour, so the price range follows the dot. */
|
|
64
|
+
const variantsFor = (variants, axisId, valueId) => {
|
|
65
|
+
if (!axisId || !valueId)
|
|
66
|
+
return variants;
|
|
67
|
+
const scoped = variants.filter((variant) => variant.options[axisId] === valueId);
|
|
68
|
+
return scoped.length > 0 ? scoped : variants;
|
|
69
|
+
};
|
|
70
|
+
exports.variantsFor = variantsFor;
|
|
71
|
+
const rangeOf = (variants) => {
|
|
72
|
+
const range = (0, commerceVariants_1.priceRange)(variants);
|
|
73
|
+
return range && range.min !== range.max ? range : undefined;
|
|
74
|
+
};
|
|
75
|
+
exports.rangeOf = rangeOf;
|
|
76
|
+
const valueSoldOut = (variants, axisId, valueId) => variants.length > 0 && !(0, commerceVariants_1.isOptionAvailable)(variants, {}, axisId, valueId);
|
|
77
|
+
exports.valueSoldOut = valueSoldOut;
|
|
78
|
+
const firstMissingAxis = (axes, selection) => axes.find((axis) => selection[axis.id] === undefined);
|
|
79
|
+
exports.firstMissingAxis = firstMissingAxis;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMinWidth = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const supported = () => typeof window !== "undefined" && typeof window.matchMedia === "function";
|
|
6
|
+
/** `matches` for a media query; false where matchMedia does not exist (SSR, jsdom). */
|
|
7
|
+
const useMinWidth = (query) => {
|
|
8
|
+
const [matches, setMatches] = (0, react_1.useState)(() => (supported() ? window.matchMedia(query).matches : false));
|
|
9
|
+
(0, react_1.useEffect)(() => {
|
|
10
|
+
if (!supported())
|
|
11
|
+
return undefined;
|
|
12
|
+
const list = window.matchMedia(query);
|
|
13
|
+
const onChange = () => setMatches(list.matches);
|
|
14
|
+
onChange();
|
|
15
|
+
list.addEventListener("change", onChange);
|
|
16
|
+
return () => list.removeEventListener("change", onChange);
|
|
17
|
+
}, [query]);
|
|
18
|
+
return matches;
|
|
19
|
+
};
|
|
20
|
+
exports.useMinWidth = useMinWidth;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { ProductDetailsProps } from "./ProductDetailsProps";
|
|
2
|
-
|
|
1
|
+
import type { ProductDetailsProps } from "./ProductDetailsProps";
|
|
2
|
+
/** Product page that wires one selection to price, stock, gallery frames and the primary action; every region has a slot. */
|
|
3
|
+
declare const ProductDetails: ({ product, selection: selectionProp, defaultSelection, onSelectionChange, quantity: quantityProp, defaultQuantity, onQuantityChange, maxQuantity, onAddToBag, onBuyNow, onNotify, onGoToBag, addedDuration, wishlisted, defaultWishlisted, onWishlistChange, onShare, offers, offersProps, trustItems, pincode, sizeGuide, onGuideClick, reviews, ratingBreakdown, reviewsProps, onWriteReview, detailSectionsProps, care, breadcrumbs, layout, mediaSlot, metaSlot, infoSlot, belowFold, relatedSlot, isLoading, labels: labelOverrides, currency, locale, "data-testid": testId, }: ProductDetailsProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
export default ProductDetails;
|