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,18 @@
|
|
|
1
|
+
import type { ProductBadge } from "../Commerce/commerceTypes";
|
|
2
|
+
/** Chip height: sm 20 px for compact cards, md 24 px for roomier cards and the product page. */
|
|
3
|
+
export type ProductBadgeSize = "sm" | "md";
|
|
4
|
+
/** solid: filled; soft: tinted; glass: translucent dark chip that stays legible over any photo. */
|
|
5
|
+
export type ProductBadgeVariant = "solid" | "soft" | "glass";
|
|
6
|
+
/** Stacking direction of the chips. */
|
|
7
|
+
export type ProductBadgesOrientation = "vertical" | "horizontal";
|
|
8
|
+
/** Corner badges for a product card or gallery; renders nothing for an empty list. */
|
|
9
|
+
export interface ProductBadgesProps {
|
|
10
|
+
/** Badges in priority order; the first `max` are shown, the rest are dropped. */
|
|
11
|
+
badges: ProductBadge[];
|
|
12
|
+
/** How many badges to show; a card carries at most two. */
|
|
13
|
+
max?: number;
|
|
14
|
+
size?: ProductBadgeSize;
|
|
15
|
+
variant?: ProductBadgeVariant;
|
|
16
|
+
orientation?: ProductBadgesOrientation;
|
|
17
|
+
"data-testid"?: string;
|
|
18
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { ProductCardProps } from "./ProductCardProps";
|
|
2
|
-
|
|
1
|
+
import type { ProductCardProps } from "./ProductCardProps";
|
|
2
|
+
/** Chromeless product card: tonal media well, brand, title, rating, price and one action; the whole card is one link target. */
|
|
3
|
+
declare const ProductCard: (props: ProductCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
export default ProductCard;
|
|
@@ -6,62 +6,113 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const react_2 = require("@chakra-ui/react");
|
|
9
|
-
const ProductTags_1 = __importDefault(require("./ProductTags"));
|
|
10
|
-
const ProductPrice_1 = __importDefault(require("./ProductPrice"));
|
|
11
|
-
const Button_1 = __importDefault(require("../Button/Button"));
|
|
12
|
-
const ProductLabel_1 = __importDefault(require("./ProductLabel"));
|
|
13
|
-
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
14
9
|
const lucide_react_1 = require("lucide-react");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
11
|
+
const motion_1 = require("../../Theme/tokens/primitives/motion");
|
|
12
|
+
const motion_2 = require("../../Theme/chakra/motion");
|
|
13
|
+
const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
|
|
14
|
+
const PriceBlock_1 = __importDefault(require("../PriceBlock/PriceBlock"));
|
|
15
|
+
const ProductBadges_1 = __importDefault(require("../ProductBadges/ProductBadges"));
|
|
16
|
+
const Rating_1 = __importDefault(require("../Rating/Rating"));
|
|
17
|
+
const StockStatus_1 = __importDefault(require("../StockStatus/StockStatus"));
|
|
18
|
+
const WishlistToggle_1 = __importDefault(require("../WishlistToggle/WishlistToggle"));
|
|
19
|
+
const optionInk_1 = require("../OptionChip/optionInk");
|
|
20
|
+
const cardLabels_1 = require("./cardLabels");
|
|
21
|
+
const cardMetrics_1 = require("./cardMetrics");
|
|
22
|
+
const productCardModel_1 = require("./productCardModel");
|
|
23
|
+
const ProductCardAction_1 = __importDefault(require("./ProductCardAction"));
|
|
24
|
+
const ProductCardMedia_1 = __importDefault(require("./ProductCardMedia"));
|
|
25
|
+
const ProductCardSkeleton_1 = __importDefault(require("./ProductCardSkeleton"));
|
|
26
|
+
const ProductCardSwatches_1 = __importDefault(require("./ProductCardSwatches"));
|
|
27
|
+
const QuickAddSheet_1 = __importDefault(require("./QuickAddSheet"));
|
|
28
|
+
const NO_AXES = [];
|
|
29
|
+
const NO_VARIANTS = [];
|
|
30
|
+
/** Chromeless product card: tonal media well, brand, title, rating, price and one action; the whole card is one link target. */
|
|
31
|
+
const ProductCard = (props) => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
const { title, brand, media, alt, price, mrp, unitPrice, rating, ratingCount, badges, axes = NO_AXES, variants = NO_VARIANTS, mediaIdsByOption, swatchLimit = productCardModel_1.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;
|
|
34
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
35
|
+
const reduced = (0, motion_2.usePrefersReducedMotion)();
|
|
36
|
+
const titleId = (0, react_1.useId)();
|
|
37
|
+
const [sheetOpen, setSheetOpen] = (0, react_1.useState)(false);
|
|
38
|
+
const [picked, setPicked] = (0, react_1.useState)(null);
|
|
39
|
+
const [previewed, setPreviewed] = (0, react_1.useState)(null);
|
|
40
|
+
const [innerQuantity, setInnerQuantity] = (0, react_1.useState)(0);
|
|
41
|
+
const [pressed, setPressed] = (0, react_1.useState)(false);
|
|
42
|
+
if (isLoading)
|
|
43
|
+
return (0, jsx_runtime_1.jsx)(ProductCardSkeleton_1.default, { layout: layout, density: density, aspectRatio: aspectRatio, "data-testid": testId });
|
|
44
|
+
const copy = { ...cardLabels_1.DEFAULT_LABELS, ...labels };
|
|
45
|
+
const m = cardMetrics_1.DENSITY[density];
|
|
46
|
+
const horizontal = layout === "list";
|
|
47
|
+
const rail = layout === "rail";
|
|
48
|
+
const soldOut = (0, productCardModel_1.isSoldOut)(outOfStock, stock, variants);
|
|
49
|
+
const sole = (0, productCardModel_1.soleVariantOf)(axes, variants);
|
|
50
|
+
const action = (0, productCardModel_1.deriveAction)(actionOverride, soldOut, axes);
|
|
51
|
+
const left = soldOut ? undefined : (0, productCardModel_1.lowStockCount)(stock, sole);
|
|
52
|
+
const bagged = quantity !== null && quantity !== void 0 ? quantity : innerQuantity;
|
|
53
|
+
const maxQuantity = (() => {
|
|
54
|
+
const count = stock !== null && stock !== void 0 ? stock : sole === null || sole === void 0 ? void 0 : sole.stock;
|
|
55
|
+
return count !== undefined && count > 0 ? count : undefined;
|
|
56
|
+
})();
|
|
57
|
+
const swatchAxis = (0, productCardModel_1.swatchAxisOf)(axes);
|
|
58
|
+
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;
|
|
59
|
+
const frames = (0, productCardModel_1.framesFor)(media, mediaIdsByOption, swatchAxis === null || swatchAxis === void 0 ? void 0 : swatchAxis.id, activeId);
|
|
60
|
+
const priced = (0, productCardModel_1.variantsFor)(variants, swatchAxis === null || swatchAxis === void 0 ? void 0 : swatchAxis.id, picked !== null && picked !== void 0 ? picked : undefined);
|
|
61
|
+
const range = sole ? undefined : (0, productCardModel_1.rangeOf)(priced);
|
|
62
|
+
const soldOutValues = new Set(swatchAxis ? swatchAxis.values.filter((value) => (0, productCardModel_1.valueSoldOut)(variants, swatchAxis.id, value.id)).map((value) => value.id) : []);
|
|
63
|
+
const interactive = !!href || !!linkAs || !!onPress;
|
|
64
|
+
const LinkTag = href || linkAs ? (linkAs !== null && linkAs !== void 0 ? linkAs : "a") : "button";
|
|
65
|
+
const linkExtras = href || linkAs ? { href, ...linkProps } : { type: "button" };
|
|
66
|
+
const add = () => {
|
|
67
|
+
if (quantity === undefined)
|
|
68
|
+
setInnerQuantity(1);
|
|
69
|
+
onAdd === null || onAdd === void 0 ? void 0 : onAdd(sole === null || sole === void 0 ? void 0 : sole.id, 1);
|
|
25
70
|
};
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
71
|
+
const press = () => {
|
|
72
|
+
if (action === "notify")
|
|
73
|
+
onNotify === null || onNotify === void 0 ? void 0 : onNotify();
|
|
74
|
+
else if (action === "options")
|
|
75
|
+
setSheetOpen(true);
|
|
76
|
+
else
|
|
77
|
+
add();
|
|
31
78
|
};
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
79
|
+
const changeQuantity = (next) => {
|
|
80
|
+
if (quantity === undefined)
|
|
81
|
+
setInnerQuantity(next);
|
|
82
|
+
onQuantityChange === null || onQuantityChange === void 0 ? void 0 : onQuantityChange(next);
|
|
37
83
|
};
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
md: { cardWidth: "20rem", imgHeight: "15rem", padding: 5 },
|
|
42
|
-
lg: { cardWidth: "22rem", imgHeight: "17rem", padding: 6 },
|
|
84
|
+
const remove = () => {
|
|
85
|
+
changeQuantity(0);
|
|
86
|
+
onRemove === null || onRemove === void 0 ? void 0 : onRemove();
|
|
43
87
|
};
|
|
44
|
-
const {
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
88
|
+
const defaultControl = ((0, jsx_runtime_1.jsx)(ProductCardAction_1.default, { 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 }));
|
|
89
|
+
const slotted = horizontal ? ((0, jsx_runtime_1.jsx)(react_2.Box, { "data-control": true, position: "relative", zIndex: 2, children: actions })) : ((0, jsx_runtime_1.jsx)(react_2.Box, { "data-control": true, position: "absolute", right: m.actionInset, bottom: m.actionInset, zIndex: 2, children: actions }));
|
|
90
|
+
const control = actions ? slotted : defaultControl;
|
|
91
|
+
const wishlist = ((0, jsx_runtime_1.jsx)(WishlistToggle_1.default, { variant: horizontal ? "soft" : "glass", size: "md", label: copy.save(title), selected: wishlisted, onSelectedChange: onWishlistChange }));
|
|
92
|
+
const hoverFrame = previewed === null ? frames[1] : undefined;
|
|
93
|
+
const pressable = interactive && !reduced;
|
|
94
|
+
const ink = (0, optionInk_1.optionInk)(colors).selected;
|
|
95
|
+
const metaLine = meta !== null && meta !== void 0 ? meta : (left !== undefined ? (0, jsx_runtime_1.jsx)(StockStatus_1.default, { status: "low-stock", count: left, size: "sm" }) : null);
|
|
96
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.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: (0, motion_1.transitionFor)(["transform"]), sx: {
|
|
97
|
+
...(rail ? { scrollSnapAlign: "start" } : {}),
|
|
98
|
+
...(0, motion_2.reducedMotionSx)(),
|
|
99
|
+
...(pressable ? { "&[data-pressed]": { transform: "scale(0.98)" } } : {}),
|
|
100
|
+
[cardMetrics_1.FINE_POINTER]: {
|
|
101
|
+
"&:hover [data-hover-frame], &:focus-within [data-hover-frame]": { opacity: 1 },
|
|
102
|
+
"&:hover [data-bar], &:focus-within [data-bar]": { opacity: 1, transform: "none" },
|
|
103
|
+
...(reduced ? {} : { "&:hover [data-primary]": { transform: "scale(1.03)" } }),
|
|
104
|
+
},
|
|
105
|
+
}, children: [(0, jsx_runtime_1.jsxs)(ProductCardMedia_1.default, { 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 ? ((0, jsx_runtime_1.jsx)(react_2.Box, { position: "absolute", top: m.badgeInset, insetStart: m.badgeInset, zIndex: 2, maxW: "calc(100% - 3.5rem)", pointerEvents: "none", children: (0, jsx_runtime_1.jsx)(ProductBadges_1.default, { badges: badges, max: 2, size: "sm", variant: "solid" }) })) : null, !horizontal ? ((0, jsx_runtime_1.jsx)(react_2.Box, { "data-control": true, position: "absolute", top: m.wishlistInset, insetEnd: m.wishlistInset, zIndex: 2, children: wishlist })) : null, selected ? ((0, jsx_runtime_1.jsx)(react_2.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: (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { size: 14, strokeWidth: 3 }) })) : null, mediaOverlay ? ((0, jsx_runtime_1.jsx)(react_2.Box, { position: "absolute", inset: 0, zIndex: 2, pointerEvents: "none", sx: { "& > *": { pointerEvents: "auto" } }, children: mediaOverlay })) : null, !horizontal ? control : null] }), (0, jsx_runtime_1.jsxs)(react_2.Flex, { direction: "column", flex: 1, minW: 0, gap: m.bodyGap, pt: horizontal ? 0 : m.bodyTop, children: [brand ? ((0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", fontSize: m.brand.size, lineHeight: `${m.brand.line}px`, fontWeight: 500, color: colors.textMuted, noOfLines: 1, children: brand })) : null, (0, jsx_runtime_1.jsx)(react_2.Text, { as: "h3", id: titleId, m: 0, fontSize: m.title.size, lineHeight: `${m.title.line}px`, fontWeight: 500, color: colors.header[900], noOfLines: cardMetrics_1.TITLE_LINES, minH: horizontal ? undefined : `${m.title.line * cardMetrics_1.TITLE_LINES}px`, children: interactive ? ((0, jsx_runtime_1.jsx)(react_2.Box, { as: LinkTag, ...linkExtras, "data-card-link": true, onClick: onPress, color: "inherit", textAlign: "start", textDecoration: "none", cursor: "pointer", sx: {
|
|
106
|
+
font: "inherit",
|
|
107
|
+
background: "none",
|
|
108
|
+
border: 0,
|
|
109
|
+
p: 0,
|
|
110
|
+
outline: "none",
|
|
111
|
+
"&::after": { content: '""', position: "absolute", inset: 0, zIndex: 1, borderRadius: cardMetrics_1.MEDIA_RADIUS },
|
|
112
|
+
"&:focus-visible::after": (0, focusRing_styles_1.focusVisibleRing)(colors),
|
|
113
|
+
}, children: title })) : (title) }), selected ? (0, jsx_runtime_1.jsx)(react_2.VisuallyHidden, { children: copy.selected }) : null, rating !== undefined && rating > 0 ? ((0, jsx_runtime_1.jsx)(Rating_1.default, { value: rating, count: ratingCount, size: "xs", compactCount: true })) : horizontal ? null : ((0, jsx_runtime_1.jsx)(react_2.Box, { minH: "1rem", "aria-hidden": true })), (0, jsx_runtime_1.jsx)(PriceBlock_1.default, { size: m.price, price: price, mrp: soldOut ? undefined : mrp, priceRange: range, unitPrice: unitPrice, currency: currency, locale: locale }), soldOut ? (0, jsx_runtime_1.jsx)(StockStatus_1.default, { status: "out-of-stock", message: copy.soldOut, size: "sm" }) : null, metaLine, swatchAxis && activeId ? ((0, jsx_runtime_1.jsx)(ProductCardSwatches_1.default, { axis: swatchAxis, limit: swatchLimit, dot: m.dot, activeId: activeId, soldOutIds: soldOutValues, labels: copy, onPreview: setPreviewed, onPick: setPicked })) : null, horizontal ? ((0, jsx_runtime_1.jsxs)(react_2.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" ? ((0, jsx_runtime_1.jsx)(QuickAddSheet_1.default, { 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) => {
|
|
114
|
+
onAdd === null || onAdd === void 0 ? void 0 : onAdd(variant.id, count);
|
|
115
|
+
setSheetOpen(false);
|
|
116
|
+
} })) : null] }));
|
|
66
117
|
};
|
|
67
118
|
exports.default = ProductCard;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ProductCardAction as ActionKind, ProductCardLabels } from "./ProductCardProps";
|
|
2
|
+
type ProductCardActionProps = {
|
|
3
|
+
kind: ActionKind;
|
|
4
|
+
title: string;
|
|
5
|
+
labels: ProductCardLabels;
|
|
6
|
+
placement: "media" | "inline";
|
|
7
|
+
inset: string;
|
|
8
|
+
hoverBar: boolean;
|
|
9
|
+
quantity: number;
|
|
10
|
+
maxQuantity?: number;
|
|
11
|
+
onPress: () => void;
|
|
12
|
+
onQuantityChange: (quantity: number) => void;
|
|
13
|
+
onRemove: () => void;
|
|
14
|
+
};
|
|
15
|
+
/** The card's one control: glass circle (or hover bar), notify pill, or the stepper it morphs into. */
|
|
16
|
+
declare const ProductCardAction: ({ kind, title, labels, placement, inset, hoverBar, quantity, maxQuantity, onPress, onQuantityChange, onRemove, }: ProductCardActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default ProductCardAction;
|
|
@@ -0,0 +1,65 @@
|
|
|
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 react_2 = require("@emotion/react");
|
|
9
|
+
const lucide_react_1 = require("lucide-react");
|
|
10
|
+
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
11
|
+
const motion_1 = require("../../Theme/tokens/primitives/motion");
|
|
12
|
+
const scrim_1 = require("../../Theme/tokens/builders/scrim");
|
|
13
|
+
const motion_2 = require("../../Theme/chakra/motion");
|
|
14
|
+
const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
|
|
15
|
+
const QuantityStepper_1 = __importDefault(require("../QuantityStepper/QuantityStepper"));
|
|
16
|
+
const cardMetrics_1 = require("./cardMetrics");
|
|
17
|
+
const morphIn = (0, react_2.keyframes) `
|
|
18
|
+
0% { opacity: 0; transform: scale(0.85); }
|
|
19
|
+
100% { opacity: 1; transform: scale(1); }
|
|
20
|
+
`;
|
|
21
|
+
const DISC = "2.25rem";
|
|
22
|
+
const BAR_HEIGHT = "2.5rem";
|
|
23
|
+
/** The card's one control: glass circle (or hover bar), notify pill, or the stepper it morphs into. */
|
|
24
|
+
const ProductCardAction = ({ kind, title, labels, placement, inset, hoverBar, quantity, maxQuantity, onPress, onQuantityChange, onRemove, }) => {
|
|
25
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
26
|
+
const reduced = (0, motion_2.usePrefersReducedMotion)();
|
|
27
|
+
const onMedia = placement === "media";
|
|
28
|
+
const place = onMedia
|
|
29
|
+
? { position: "absolute", right: inset, bottom: inset, zIndex: 2 }
|
|
30
|
+
: { position: "relative", zIndex: 2 };
|
|
31
|
+
if (quantity > 0) {
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(react_1.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_1.MOTION_EASE}`, children: (0, jsx_runtime_1.jsx)(QuantityStepper_1.default, { size: "sm", value: quantity, min: 1, max: maxQuantity, removable: true, itemLabel: title, onValueChange: onQuantityChange, onRemove: onRemove }) }));
|
|
33
|
+
}
|
|
34
|
+
const isNotify = kind === "notify";
|
|
35
|
+
const name = isNotify ? labels.notifyMeFor(title) : kind === "options" ? labels.chooseOptions(title) : labels.addToBag(title);
|
|
36
|
+
const barText = kind === "options" ? labels.chooseOptionsText : labels.addToBagText;
|
|
37
|
+
const bar = onMedia && hoverBar && !isNotify;
|
|
38
|
+
const look = onMedia
|
|
39
|
+
? { bg: (0, scrim_1.overlayScrim)(colors), hoverBg: (0, scrim_1.overlayScrim)(colors), color: colors.white }
|
|
40
|
+
: { bg: colors.background[100], hoverBg: colors.background[200], color: colors.header[900] };
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.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: (0, motion_1.transitionFor)(["background-color", "opacity", "transform"], "base"), _hover: { bg: look.hoverBg }, _active: reduced ? undefined : { transform: "scale(0.9)" }, sx: {
|
|
42
|
+
outline: "none",
|
|
43
|
+
...(onMedia ? { backdropFilter: "blur(8px)", WebkitBackdropFilter: "blur(8px)" } : {}),
|
|
44
|
+
...(0, focusRing_styles_1.focusVisibleStyles)(colors),
|
|
45
|
+
...(0, motion_2.reducedMotionSx)({ "&:active": { transform: "none" } }),
|
|
46
|
+
"&::before": { content: '""', position: "absolute", inset: "-0.25rem" },
|
|
47
|
+
"& [data-label]": { display: isNotify ? "inline" : "none" },
|
|
48
|
+
...(bar
|
|
49
|
+
? {
|
|
50
|
+
[cardMetrics_1.FINE_POINTER]: {
|
|
51
|
+
left: inset,
|
|
52
|
+
right: "auto",
|
|
53
|
+
width: `calc(100% - 2 * ${inset})`,
|
|
54
|
+
height: BAR_HEIGHT,
|
|
55
|
+
borderRadius: "lg",
|
|
56
|
+
opacity: 0,
|
|
57
|
+
transform: reduced ? "none" : "translateY(0.5rem)",
|
|
58
|
+
"& [data-label]": { display: "inline" },
|
|
59
|
+
"&:focus-visible": { opacity: 1, transform: "none" },
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
: {}),
|
|
63
|
+
}, children: [isNotify ? (0, jsx_runtime_1.jsx)(lucide_react_1.Bell, { size: 16, "aria-hidden": true }) : (0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { size: 18, strokeWidth: 2.25, "aria-hidden": true }), (0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", "data-label": true, fontSize: "0.8125rem", fontWeight: 600, lineHeight: 1, whiteSpace: "nowrap", children: isNotify ? labels.notifyMe : barText })] }));
|
|
64
|
+
};
|
|
65
|
+
exports.default = ProductCardAction;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProductCardGridProps } from "./ProductCardProps";
|
|
2
|
+
/** 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. */
|
|
3
|
+
declare const ProductCardGrid: ({ children, columns, gap, columnGap, rowGap, "aria-label": ariaLabel, "data-testid": testId }: ProductCardGridProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default ProductCardGrid;
|
|
@@ -0,0 +1,20 @@
|
|
|
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 DEFAULT_COLUMNS = { base: 2, sm: 2, md: 3, lg: 4, xl: 5 };
|
|
7
|
+
const template = (columns) => `repeat(${columns}, minmax(0, 1fr))`;
|
|
8
|
+
/** 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. */
|
|
9
|
+
const ProductCardGrid = ({ children, columns, gap, columnGap, rowGap, "aria-label": ariaLabel, "data-testid": testId }) => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const cols = { ...DEFAULT_COLUMNS, ...columns };
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(react_2.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: {
|
|
13
|
+
base: template(cols.base),
|
|
14
|
+
sm: template(cols.sm),
|
|
15
|
+
md: template(cols.md),
|
|
16
|
+
lg: template(cols.lg),
|
|
17
|
+
xl: template(cols.xl),
|
|
18
|
+
}, children: react_1.Children.toArray(children).map((child, index) => ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "li", display: "flex", minW: 0, children: (0, jsx_runtime_1.jsx)(react_2.Box, { display: "flex", flexDirection: "column", flex: 1, minW: 0, children: child }) }, index))) }));
|
|
19
|
+
};
|
|
20
|
+
exports.default = ProductCardGrid;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ProductMedia } from "../Commerce/commerceTypes";
|
|
3
|
+
import type { ProductCardAspectRatio } from "./ProductCardProps";
|
|
4
|
+
type ProductCardMediaProps = {
|
|
5
|
+
primary: ProductMedia | undefined;
|
|
6
|
+
hover: ProductMedia | undefined;
|
|
7
|
+
title: string;
|
|
8
|
+
alt?: string;
|
|
9
|
+
aspectRatio: ProductCardAspectRatio;
|
|
10
|
+
dimmed: boolean;
|
|
11
|
+
selected: boolean;
|
|
12
|
+
fallbackText: string;
|
|
13
|
+
width?: string;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
};
|
|
16
|
+
/** Tonal media well: cover-fitted primary frame, optional hover frame, broken-image tile; overlays are children. */
|
|
17
|
+
declare const ProductCardMedia: ({ primary, hover, title, alt, aspectRatio, dimmed, selected, fallbackText, width, children, }: ProductCardMediaProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export default ProductCardMedia;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 lucide_react_1 = require("lucide-react");
|
|
7
|
+
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
8
|
+
const motion_1 = require("../../Theme/tokens/primitives/motion");
|
|
9
|
+
const motion_2 = require("../../Theme/chakra/motion");
|
|
10
|
+
const cardMetrics_1 = require("./cardMetrics");
|
|
11
|
+
const DIMMED_OPACITY = 0.6;
|
|
12
|
+
const Frame = ({ src, alt, fallbackText, quiet = false }) => {
|
|
13
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
14
|
+
const ref = (0, react_1.useRef)(null);
|
|
15
|
+
const [loaded, setLoaded] = (0, react_1.useState)(false);
|
|
16
|
+
const [failed, setFailed] = (0, react_1.useState)(src === "");
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
const el = ref.current;
|
|
19
|
+
if (el && el.complete && el.naturalWidth > 0)
|
|
20
|
+
setLoaded(true);
|
|
21
|
+
}, []);
|
|
22
|
+
if (failed) {
|
|
23
|
+
if (quiet)
|
|
24
|
+
return null;
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.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: [(0, jsx_runtime_1.jsx)(lucide_react_1.ImageOff, { size: 24, "aria-hidden": true }), fallbackText ? ((0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", fontSize: "xs", fontWeight: 500, children: fallbackText })) : null] }));
|
|
26
|
+
}
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(react_2.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: (0, motion_1.transitionFor)(["opacity"]), sx: (0, motion_2.reducedMotionSx)() }));
|
|
28
|
+
};
|
|
29
|
+
/** Tonal media well: cover-fitted primary frame, optional hover frame, broken-image tile; overlays are children. */
|
|
30
|
+
const ProductCardMedia = ({ primary, hover, title, alt, aspectRatio, dimmed, selected, fallbackText, width, children, }) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { "data-media": true, "data-ratio": aspectRatio, position: "relative", flexShrink: 0, w: width !== null && width !== void 0 ? width : "100%", sx: { aspectRatio: cardMetrics_1.CSS_RATIO[aspectRatio] }, borderRadius: cardMetrics_1.MEDIA_RADIUS, overflow: "hidden", bg: colors.background[100], boxShadow: selected ? `0 0 0 2px ${colors.header[900]}` : "none", transition: (0, motion_1.transitionFor)(["box-shadow"]), children: [(0, jsx_runtime_1.jsx)(react_2.Box, { "data-primary": true, position: "absolute", inset: 0, opacity: dimmed ? DIMMED_OPACITY : 1, transition: (0, motion_1.transitionFor)(["transform", "opacity"], "base"), sx: (0, motion_2.reducedMotionSx)(), children: primary ? ((0, jsx_runtime_1.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)) : ((0, jsx_runtime_1.jsx)(Frame, { src: "", alt: alt !== null && alt !== void 0 ? alt : title, fallbackText: fallbackText }, "none")) }), hover ? ((0, jsx_runtime_1.jsx)(react_2.Box, { "data-hover-frame": true, "aria-hidden": true, position: "absolute", inset: 0, opacity: 0, pointerEvents: "none", transition: (0, motion_1.transitionFor)(["opacity"], "base"), sx: (0, motion_2.reducedMotionSx)(), children: (0, jsx_runtime_1.jsx)(Frame, { src: hover.src, alt: "", quiet: true }, hover.src) })) : null, children] }));
|
|
34
|
+
};
|
|
35
|
+
exports.default = ProductCardMedia;
|
|
@@ -1,57 +1,139 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
button
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
import type { ComponentPropsWithoutRef, ElementType, MouseEvent, ReactNode } from "react";
|
|
2
|
+
import type { OptionAxis, PriceFormat, ProductBadge, ProductMedia, ProductVariant } from "../Commerce/commerceTypes";
|
|
3
|
+
import type { UnitPrice } from "../../Utils/price";
|
|
4
|
+
import type { QuickAddPresentation, QuickAddSheetProps } from "./QuickAddSheetProps";
|
|
5
|
+
/** grid fills its column, list is a horizontal row with the action in the body, rail is a fixed-width scroll-snap item. */
|
|
6
|
+
export type ProductCardLayout = "grid" | "list" | "rail";
|
|
7
|
+
/** Type, insets and the add affordance scale together: compact is the 173 px phone 2-up, spacious the desktop 4-up. */
|
|
8
|
+
export type ProductCardDensity = "compact" | "comfortable" | "spacious";
|
|
9
|
+
/** Ratio of the media well; images cover it, so one ratio per grid keeps rows level. */
|
|
10
|
+
export type ProductCardAspectRatio = "4/5" | "1/1" | "3/4";
|
|
11
|
+
/** What the primary control does: choose options in the sheet, add at once, or ask to be notified. */
|
|
12
|
+
export type ProductCardAction = "options" | "add" | "notify";
|
|
13
|
+
/** Fires when the card (title link or button) is pressed anywhere outside its own controls. */
|
|
14
|
+
export type ProductCardPressHandler = (event: MouseEvent<HTMLElement>) => void;
|
|
15
|
+
/** Visible and screen-reader copy of the card's own controls; override every string for another language. */
|
|
16
|
+
export interface ProductCardLabels {
|
|
17
|
+
/** Wishlist button name, given the product title. */
|
|
18
|
+
save: (title: string) => string;
|
|
19
|
+
/** Name of the control that opens the option sheet, given the product title. */
|
|
20
|
+
chooseOptions: (title: string) => string;
|
|
21
|
+
/** Name of the control that adds a product with no options, given the product title. */
|
|
22
|
+
addToBag: (title: string) => string;
|
|
23
|
+
/** Visible text of the notify control. */
|
|
24
|
+
notifyMe: string;
|
|
25
|
+
/** Name of the notify control, given the product title. */
|
|
26
|
+
notifyMeFor: (title: string) => string;
|
|
27
|
+
/** Visible text on the hover bar of a spacious card whose action opens options. */
|
|
28
|
+
chooseOptionsText: string;
|
|
29
|
+
/** Visible text on the hover bar of a spacious card that adds directly. */
|
|
30
|
+
addToBagText: string;
|
|
31
|
+
/** Status text of an unavailable product. */
|
|
32
|
+
soldOut: string;
|
|
33
|
+
/** Screen-reader text added to a selected card. */
|
|
34
|
+
selected: string;
|
|
35
|
+
/** Screen-reader text after the "+N" swatch count, given N. */
|
|
36
|
+
moreColours: (count: number) => string;
|
|
37
|
+
/** Image fallback text. */
|
|
38
|
+
imageUnavailable: string;
|
|
39
|
+
}
|
|
40
|
+
/** Product card for listings, rails and search: media, brand, title, rating, price, swatches and one action; owns no product vocabulary beyond `axes`. */
|
|
41
|
+
export interface ProductCardProps extends PriceFormat {
|
|
42
|
+
title: string;
|
|
43
|
+
/** Muted line above the title; own-brand stores omit it. */
|
|
44
|
+
brand?: string;
|
|
45
|
+
/** First frame is the primary image, the second is the hover frame; every frame is also the pool `mediaIdsByOption` points into. */
|
|
46
|
+
media: ProductMedia[];
|
|
47
|
+
/** Alt text for the primary image when the media item has none; defaults to the title. */
|
|
48
|
+
alt?: string;
|
|
49
|
+
/** Selling price; a range replaces it when `variants` differ in price. */
|
|
41
50
|
price: number;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
/** List price; the strike and discount show only when above `price` and the product is in stock. */
|
|
52
|
+
mrp?: number;
|
|
53
|
+
/** A `unitPrice()` result or a ready string, shown under the price. */
|
|
54
|
+
unitPrice?: UnitPrice | string | null;
|
|
55
|
+
/** 0 to 5; the row is hidden when missing or 0, never rendered as "0 reviews". */
|
|
56
|
+
rating?: number;
|
|
57
|
+
ratingCount?: number;
|
|
58
|
+
/** Badges in priority order; at most two are drawn, and none on a sold-out card. */
|
|
59
|
+
badges?: ProductBadge[];
|
|
60
|
+
/** Option axes; any axis with more than one value makes the primary action open the quick-add sheet. */
|
|
61
|
+
axes?: OptionAxis[];
|
|
62
|
+
/** Variants the axes resolve to; drive availability, the price range and the sheet's confirm button. */
|
|
63
|
+
variants?: ProductVariant[];
|
|
64
|
+
/** Maps `"<axisId>:<valueId>"` to the media ids shown for that value, so a swatch swaps the card image. */
|
|
65
|
+
mediaIdsByOption?: Record<string, string[]>;
|
|
66
|
+
/** Most colour dots shown before "+N". */
|
|
67
|
+
swatchLimit?: number;
|
|
68
|
+
/** Units left for a product without variants; shown as "Only N left" at or under the low-stock threshold. */
|
|
69
|
+
stock?: number;
|
|
70
|
+
/** Forces the sold-out state; derived from `variants` or `stock` when omitted. */
|
|
71
|
+
outOfStock?: boolean;
|
|
72
|
+
/** Renders the title as a link and makes the whole card its target. */
|
|
73
|
+
href?: string;
|
|
74
|
+
/** Component for the title link, e.g. a router Link; receives `href` and `linkProps`. */
|
|
75
|
+
linkAs?: ElementType;
|
|
76
|
+
/** Extra props for the title link, e.g. `{ to: "/p/jacket" }` for a router Link. */
|
|
77
|
+
linkProps?: Omit<ComponentPropsWithoutRef<"a">, "href" | "onClick">;
|
|
78
|
+
/** Makes the title a stretched button when there is no `href`, or runs beside navigation when there is. */
|
|
79
|
+
onPress?: ProductCardPressHandler;
|
|
80
|
+
layout?: ProductCardLayout;
|
|
81
|
+
density?: ProductCardDensity;
|
|
82
|
+
aspectRatio?: ProductCardAspectRatio;
|
|
83
|
+
/** Overrides the action derived from the data (notify when sold out, options when an axis has choices, else add). */
|
|
84
|
+
action?: ProductCardAction;
|
|
85
|
+
/** Units in the bag; above 0 the add control becomes a stepper. Omit to let the card track it after a direct add. */
|
|
86
|
+
quantity?: number;
|
|
87
|
+
/** Fires from the stepper; 0 means the shopper removed the product. */
|
|
88
|
+
onQuantityChange?: (quantity: number) => void;
|
|
89
|
+
/** How the quick-add sheet opens; `auto` follows the window width, so pass `drawer` inside a phone-width frame. */
|
|
90
|
+
quickAddPresentation?: QuickAddPresentation;
|
|
91
|
+
/** Forwarded to the quick-add drawer panel; the drawer portals to the window; see `QuickAddSheetProps.drawerContentProps` for capping its width. */
|
|
92
|
+
quickAddDrawerProps?: QuickAddSheetProps["drawerContentProps"];
|
|
93
|
+
/** Fires on a direct add (quantity 1) and from the quick-add sheet; `variantId` is the chosen variant when one is known. */
|
|
94
|
+
onAdd?: (variantId: string | undefined, quantity: number) => void;
|
|
95
|
+
/** Fires when the stepper's minus is pressed at 1, after `onQuantityChange(0)`. */
|
|
96
|
+
onRemove?: () => void;
|
|
97
|
+
/** Fires from the notify control of a sold-out card. */
|
|
98
|
+
onNotify?: () => void;
|
|
99
|
+
/** Controlled wishlist state. */
|
|
100
|
+
wishlisted?: boolean;
|
|
101
|
+
onWishlistChange?: (wishlisted: boolean) => void;
|
|
102
|
+
/** Marks the card as chosen (compare, bulk select): a ring on the media and a check, never colour alone. */
|
|
103
|
+
selected?: boolean;
|
|
104
|
+
/** Renders the skeleton with the same box model, so nothing shifts on load. */
|
|
105
|
+
isLoading?: boolean;
|
|
106
|
+
/** Glass content laid over the media well, clear of the badge, wishlist and action corners. */
|
|
107
|
+
mediaOverlay?: ReactNode;
|
|
108
|
+
/** Replaces the default meta line (low-stock status) under the price; sold-out status stays. */
|
|
109
|
+
meta?: ReactNode;
|
|
110
|
+
/** Replaces the derived add control, keeping its footprint. */
|
|
111
|
+
actions?: ReactNode;
|
|
112
|
+
labels?: Partial<ProductCardLabels>;
|
|
113
|
+
"data-testid"?: string;
|
|
114
|
+
}
|
|
115
|
+
/** Skeleton with the card's box model; pass the same layout, density and ratio as the loaded cards. */
|
|
116
|
+
export interface ProductCardSkeletonProps {
|
|
117
|
+
layout?: ProductCardLayout;
|
|
118
|
+
density?: ProductCardDensity;
|
|
119
|
+
aspectRatio?: ProductCardAspectRatio;
|
|
120
|
+
"data-testid"?: string;
|
|
121
|
+
}
|
|
122
|
+
/** Column counts per breakpoint of a card grid. */
|
|
123
|
+
export type ProductCardGridColumns = Partial<Record<"base" | "sm" | "md" | "lg" | "xl", number>>;
|
|
124
|
+
/** Responsive grid for cards: 2 columns on a phone up to 5 on a wide screen, equal-height rows, one gap scale. */
|
|
125
|
+
export interface ProductCardGridProps {
|
|
126
|
+
/** One card per child; each is wrapped in a list item that stretches it to the row height. */
|
|
127
|
+
children: ReactNode;
|
|
128
|
+
/** Columns per breakpoint; defaults to 2, 3 from md, 4 from lg and 5 from xl. */
|
|
129
|
+
columns?: ProductCardGridColumns;
|
|
130
|
+
/** Gap on both axes, overriding the window-based gaps; a number is in Chakra space units, a string any CSS length. */
|
|
131
|
+
gap?: string | number;
|
|
132
|
+
/** Column gap only; wins over `gap`. */
|
|
133
|
+
columnGap?: string | number;
|
|
134
|
+
/** Row gap only; wins over `gap`. */
|
|
135
|
+
rowGap?: string | number;
|
|
136
|
+
/** Accessible name of the list, e.g. "Jackets". */
|
|
137
|
+
"aria-label"?: string;
|
|
138
|
+
"data-testid"?: string;
|
|
139
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProductCardSkeletonProps } from "./ProductCardProps";
|
|
2
|
+
/** Loading twin of ProductCard: same media ratio, title reservation and gaps, so the swap never moves the grid. */
|
|
3
|
+
declare const ProductCardSkeleton: ({ layout, density, aspectRatio, "data-testid": testId, }: ProductCardSkeletonProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default ProductCardSkeleton;
|