pixelize-design-library 2.4.2-beta.56 → 2.4.2-beta.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -0
- package/COMPONENT-GOTCHAS.md +48 -20
- package/DESIGN-GUIDE.md +18 -1
- package/dist/Components/AddressCard/AddressCard.d.ts +4 -0
- package/dist/Components/AddressCard/AddressCard.js +25 -0
- package/dist/Components/AddressCard/AddressCardGroup.d.ts +4 -0
- package/dist/Components/AddressCard/AddressCardGroup.js +7 -0
- package/dist/Components/AddressCard/AddressCardProps.d.ts +43 -0
- package/dist/Components/AddressCard/AddressCardProps.js +2 -0
- package/dist/Components/BagBar/BagBar.d.ts +4 -0
- package/dist/Components/BagBar/BagBar.js +32 -0
- package/dist/Components/BagBar/BagBarProps.d.ts +30 -0
- package/dist/Components/BagBar/BagBarProps.js +2 -0
- package/dist/Components/CartItem/CartItem.d.ts +4 -0
- package/dist/Components/CartItem/CartItem.js +60 -0
- package/dist/Components/CartItem/CartItemProps.d.ts +64 -0
- package/dist/Components/CartItem/CartItemProps.js +2 -0
- package/dist/Components/CartItem/cartItemOptions.d.ts +3 -0
- package/dist/Components/CartItem/cartItemOptions.js +13 -0
- package/dist/Components/CheckoutKit/selectable.d.ts +58 -0
- package/dist/Components/CheckoutKit/selectable.js +120 -0
- package/dist/Components/Commerce/commerceTypes.d.ts +52 -0
- package/dist/Components/Commerce/commerceTypes.js +2 -0
- package/dist/Components/Commerce/commerceVariants.d.ts +13 -0
- package/dist/Components/Commerce/commerceVariants.js +51 -0
- package/dist/Components/Commerce/index.d.ts +2 -0
- package/dist/Components/Commerce/index.js +18 -0
- package/dist/Components/Commerce/useContainerWidth.d.ts +3 -0
- package/dist/Components/Commerce/useContainerWidth.js +25 -0
- package/dist/Components/CouponField/CouponField.d.ts +4 -0
- package/dist/Components/CouponField/CouponField.js +72 -0
- package/dist/Components/CouponField/CouponFieldProps.d.ts +49 -0
- package/dist/Components/CouponField/CouponFieldProps.js +2 -0
- package/dist/Components/DatePicker/PickerPortal.d.ts +11 -0
- package/dist/Components/DatePicker/PickerPortal.js +26 -0
- package/dist/Components/DatePicker/RangeDatePicker.d.ts +1 -1
- package/dist/Components/DatePicker/RangeDatePicker.js +67 -32
- package/dist/Components/DatePicker/SingleDatePicker.js +49 -13
- package/dist/Components/DatePicker/TimeOnlyPicker.js +39 -4
- package/dist/Components/DetailSections/DetailSections.d.ts +4 -0
- package/dist/Components/DetailSections/DetailSections.js +112 -0
- package/dist/Components/DetailSections/DetailSectionsProps.d.ts +58 -0
- package/dist/Components/DetailSections/DetailSectionsProps.js +2 -0
- package/dist/Components/MediaGallery/MediaFrame.d.ts +31 -0
- package/dist/Components/MediaGallery/MediaFrame.js +55 -0
- package/dist/Components/MediaGallery/MediaGallery.d.ts +4 -0
- package/dist/Components/MediaGallery/MediaGallery.js +206 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.d.ts +76 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.js +20 -0
- package/dist/Components/MediaGallery/MediaLightbox.d.ts +4 -0
- package/dist/Components/MediaGallery/MediaLightbox.js +116 -0
- package/dist/Components/MediaGallery/MediaLightboxProps.d.ts +40 -0
- package/dist/Components/MediaGallery/MediaLightboxProps.js +15 -0
- package/dist/Components/MediaGallery/MediaThumb.d.ts +18 -0
- package/dist/Components/MediaGallery/MediaThumb.js +25 -0
- package/dist/Components/MediaGallery/glass.d.ts +31 -0
- package/dist/Components/MediaGallery/glass.js +47 -0
- package/dist/Components/MediaGallery/mediaGalleryModel.d.ts +22 -0
- package/dist/Components/MediaGallery/mediaGalleryModel.js +83 -0
- package/dist/Components/MediaGallery/motion.d.ts +5 -0
- package/dist/Components/MediaGallery/motion.js +12 -0
- package/dist/Components/MediaGallery/useMatchMedia.d.ts +2 -0
- package/dist/Components/MediaGallery/useMatchMedia.js +20 -0
- package/dist/Components/OffersList/OffersList.d.ts +4 -0
- package/dist/Components/OffersList/OffersList.js +83 -0
- package/dist/Components/OffersList/OffersListProps.d.ts +34 -0
- package/dist/Components/OffersList/OffersListProps.js +2 -0
- package/dist/Components/OptionChip/OptionChip.d.ts +4 -0
- package/dist/Components/OptionChip/OptionChip.js +97 -0
- package/dist/Components/OptionChip/OptionChipProps.d.ts +33 -0
- package/dist/Components/OptionChip/OptionChipProps.js +2 -0
- package/dist/Components/OptionChip/optionInk.d.ts +12 -0
- package/dist/Components/OptionChip/optionInk.js +25 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.d.ts +4 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.js +57 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.d.ts +29 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +2 -0
- package/dist/Components/OrderSummary/OrderSummary.d.ts +4 -0
- package/dist/Components/OrderSummary/OrderSummary.js +63 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.d.ts +53 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.js +2 -0
- package/dist/Components/PaymentOption/PaymentOption.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOption.js +24 -0
- package/dist/Components/PaymentOption/PaymentOptionGroup.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOptionGroup.js +7 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.d.ts +32 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.js +2 -0
- package/dist/Components/PincodeChecker/PincodeChecker.d.ts +4 -0
- package/dist/Components/PincodeChecker/PincodeChecker.js +175 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.d.ts +57 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.js +2 -0
- package/dist/Components/PriceBlock/PriceBlock.d.ts +4 -0
- package/dist/Components/PriceBlock/PriceBlock.js +41 -0
- package/dist/Components/PriceBlock/PriceBlockProps.d.ts +39 -0
- package/dist/Components/PriceBlock/PriceBlockProps.js +2 -0
- package/dist/Components/ProductBadges/ProductBadges.d.ts +4 -0
- package/dist/Components/ProductBadges/ProductBadges.js +61 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.d.ts +18 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.js +2 -0
- package/dist/Components/ProductCard/ProductCard.d.ts +3 -2
- package/dist/Components/ProductCard/ProductCard.js +103 -52
- package/dist/Components/ProductCard/ProductCardAction.d.ts +17 -0
- package/dist/Components/ProductCard/ProductCardAction.js +65 -0
- package/dist/Components/ProductCard/ProductCardGrid.d.ts +4 -0
- package/dist/Components/ProductCard/ProductCardGrid.js +20 -0
- package/dist/Components/ProductCard/ProductCardMedia.d.ts +18 -0
- package/dist/Components/ProductCard/ProductCardMedia.js +35 -0
- package/dist/Components/ProductCard/ProductCardProps.d.ts +138 -56
- package/dist/Components/ProductCard/ProductCardSkeleton.d.ts +4 -0
- package/dist/Components/ProductCard/ProductCardSkeleton.js +17 -0
- package/dist/Components/ProductCard/ProductCardSwatches.d.ts +15 -0
- package/dist/Components/ProductCard/ProductCardSwatches.js +37 -0
- package/dist/Components/ProductCard/QuickAddSheet.d.ts +4 -0
- package/dist/Components/ProductCard/QuickAddSheet.js +109 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.d.ts +38 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.js +2 -0
- package/dist/Components/ProductCard/cardLabels.d.ts +2 -0
- package/dist/Components/ProductCard/cardLabels.js +16 -0
- package/dist/Components/ProductCard/cardMetrics.d.ts +27 -0
- package/dist/Components/ProductCard/cardMetrics.js +55 -0
- package/dist/Components/ProductCard/productCardFixtures.d.ts +7 -0
- package/dist/Components/ProductCard/productCardFixtures.js +61 -0
- package/dist/Components/ProductCard/productCardModel.d.ts +22 -0
- package/dist/Components/ProductCard/productCardModel.js +79 -0
- package/dist/Components/ProductCard/useMinWidth.d.ts +2 -0
- package/dist/Components/ProductCard/useMinWidth.js +20 -0
- package/dist/Components/ProductDetails/ProductDetails.d.ts +3 -2
- package/dist/Components/ProductDetails/ProductDetails.js +209 -33
- package/dist/Components/ProductDetails/ProductDetailsProps.d.ts +143 -41
- package/dist/Components/ProductDetails/productDetailsModel.d.ts +14 -0
- package/dist/Components/ProductDetails/productDetailsModel.js +45 -0
- package/dist/Components/ProductDetails/useInViewport.d.ts +3 -0
- package/dist/Components/ProductDetails/useInViewport.js +18 -0
- package/dist/Components/QuantityStepper/QuantityStepper.d.ts +4 -0
- package/dist/Components/QuantityStepper/QuantityStepper.js +59 -0
- package/dist/Components/QuantityStepper/QuantityStepperProps.d.ts +24 -0
- package/dist/Components/QuantityStepper/QuantityStepperProps.js +2 -0
- package/dist/Components/Rating/Rating.d.ts +4 -0
- package/dist/Components/Rating/Rating.js +81 -0
- package/dist/Components/Rating/RatingProps.d.ts +27 -0
- package/dist/Components/Rating/RatingProps.js +2 -0
- package/dist/Components/ReviewList/ReviewList.d.ts +4 -0
- package/dist/Components/ReviewList/ReviewList.js +94 -0
- package/dist/Components/ReviewList/ReviewListProps.d.ts +68 -0
- package/dist/Components/ReviewList/ReviewListProps.js +2 -0
- package/dist/Components/ReviewSummary/ReviewSummary.d.ts +4 -0
- package/dist/Components/ReviewSummary/ReviewSummary.js +47 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.d.ts +31 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.js +2 -0
- package/dist/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/Components/SegmentedControl/SegmentedControl.js +17 -5
- package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +6 -0
- package/dist/Components/SegmentedControl/segmentedInk.d.ts +2 -0
- package/dist/Components/SegmentedControl/segmentedInk.js +4 -1
- package/dist/Components/SegmentedControl/useSlidingPill.d.ts +2 -0
- package/dist/Components/SegmentedControl/useSlidingPill.js +6 -1
- package/dist/Components/SideBar/SecondaryBar.js +13 -8
- package/dist/Components/SideBar/SideBarProps.d.ts +3 -1
- package/dist/Components/SideBar/components/MenuItemBox.js +47 -10
- package/dist/Components/SideBar/components/MenuPopoverContent.js +4 -3
- package/dist/Components/SpecTable/SpecTable.d.ts +4 -0
- package/dist/Components/SpecTable/SpecTable.js +39 -0
- package/dist/Components/SpecTable/SpecTableProps.d.ts +25 -0
- package/dist/Components/SpecTable/SpecTableProps.js +2 -0
- package/dist/Components/Spinner/Spinner.d.ts +1 -1
- package/dist/Components/Spinner/Spinner.js +2 -2
- package/dist/Components/Spinner/SpinnerProps.d.ts +2 -0
- package/dist/Components/StageProgress/StepperStage.js +2 -1
- package/dist/Components/StatCard/StatCard.d.ts +1 -1
- package/dist/Components/StatCard/StatCard.js +2 -2
- package/dist/Components/StatCard/StatCardProps.d.ts +4 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.d.ts +3 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.js +85 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.d.ts +54 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.js +2 -0
- package/dist/Components/StockStatus/StockStatus.d.ts +4 -0
- package/dist/Components/StockStatus/StockStatus.js +31 -0
- package/dist/Components/StockStatus/StockStatusProps.d.ts +14 -0
- package/dist/Components/StockStatus/StockStatusProps.js +2 -0
- package/dist/Components/Table/Table.js +2 -1
- package/dist/Components/Table/TableProps.d.ts +5 -2
- package/dist/Components/Table/columnLabel.d.ts +6 -0
- package/dist/Components/Table/columnLabel.js +27 -0
- package/dist/Components/Table/components/TableBody.js +5 -1
- package/dist/Components/Table/components/TableHeader.js +3 -2
- package/dist/Components/Table/filters/ActiveFilters.js +2 -1
- package/dist/Components/Table/filters/TableFilters.js +2 -1
- package/dist/Components/Table/hooks/useTable.js +3 -2
- package/dist/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/Components/Table/settings/TableSettings.js +2 -1
- package/dist/Components/TrustBadges/TrustBadges.d.ts +4 -0
- package/dist/Components/TrustBadges/TrustBadges.js +24 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.d.ts +20 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.js +2 -0
- package/dist/Components/VariantSelector/VariantSelector.d.ts +4 -0
- package/dist/Components/VariantSelector/VariantSelector.js +123 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.d.ts +27 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.js +2 -0
- package/dist/Components/VariantSelector/variantSelection.d.ts +6 -0
- package/dist/Components/VariantSelector/variantSelection.js +25 -0
- package/dist/Components/WishlistToggle/WishlistToggle.d.ts +4 -0
- package/dist/Components/WishlistToggle/WishlistToggle.js +65 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.d.ts +19 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.js +2 -0
- package/dist/Theme/assertPalette.d.ts +1 -1
- package/dist/Theme/assertPalette.js +1 -1
- package/dist/Theme/tokens/brands/index.js +2 -0
- package/dist/Theme/tokens/brands/zinc/palette.dark.d.ts +1 -0
- package/dist/Theme/tokens/builders/buildDarkPalette.js +2 -0
- package/dist/Theme/tokens/builders/index.d.ts +1 -0
- package/dist/Theme/tokens/builders/index.js +1 -0
- package/dist/Theme/tokens/builders/rechartsTheme.d.ts +56 -0
- package/dist/Theme/tokens/builders/rechartsTheme.js +43 -0
- package/dist/Theme/tokens/builders/star.d.ts +3 -0
- package/dist/Theme/tokens/builders/star.js +8 -0
- package/dist/Theme/tokens/types.d.ts +3 -1
- package/dist/Theme/useChartTheme.d.ts +4 -0
- package/dist/Theme/useChartTheme.js +12 -0
- package/dist/Utils/price.d.ts +16 -0
- package/dist/Utils/price.js +34 -0
- package/dist/esm/Components/AddressCard/AddressCard.js +20 -0
- package/dist/esm/Components/AddressCard/AddressCardGroup.js +5 -0
- package/dist/esm/Components/AddressCard/AddressCardProps.js +1 -0
- package/dist/esm/Components/BagBar/BagBar.js +27 -0
- package/dist/esm/Components/BagBar/BagBarProps.js +1 -0
- package/dist/esm/Components/CartItem/CartItem.js +55 -0
- package/dist/esm/Components/CartItem/CartItemProps.js +1 -0
- package/dist/esm/Components/CartItem/cartItemOptions.js +9 -0
- package/dist/esm/Components/CheckoutKit/selectable.js +112 -0
- package/dist/esm/Components/Commerce/commerceTypes.js +1 -0
- package/dist/esm/Components/Commerce/commerceVariants.js +41 -0
- package/dist/esm/Components/Commerce/index.js +2 -0
- package/dist/esm/Components/Commerce/useContainerWidth.js +21 -0
- package/dist/esm/Components/CouponField/CouponField.js +67 -0
- package/dist/esm/Components/CouponField/CouponFieldProps.js +1 -0
- package/dist/esm/Components/DatePicker/PickerPortal.js +21 -0
- package/dist/esm/Components/DatePicker/RangeDatePicker.js +34 -32
- package/dist/esm/Components/DatePicker/SingleDatePicker.js +16 -13
- package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +6 -4
- package/dist/esm/Components/DetailSections/DetailSections.js +107 -0
- package/dist/esm/Components/DetailSections/DetailSectionsProps.js +1 -0
- package/dist/esm/Components/MediaGallery/MediaFrame.js +48 -0
- package/dist/esm/Components/MediaGallery/MediaGallery.js +201 -0
- package/dist/esm/Components/MediaGallery/MediaGalleryProps.js +17 -0
- package/dist/esm/Components/MediaGallery/MediaLightbox.js +78 -0
- package/dist/esm/Components/MediaGallery/MediaLightboxProps.js +12 -0
- package/dist/esm/Components/MediaGallery/MediaThumb.js +23 -0
- package/dist/esm/Components/MediaGallery/glass.js +42 -0
- package/dist/esm/Components/MediaGallery/mediaGalleryModel.js +71 -0
- package/dist/esm/Components/MediaGallery/motion.js +8 -0
- package/dist/esm/Components/MediaGallery/useMatchMedia.js +16 -0
- package/dist/esm/Components/OffersList/OffersList.js +81 -0
- package/dist/esm/Components/OffersList/OffersListProps.js +1 -0
- package/dist/esm/Components/OptionChip/OptionChip.js +95 -0
- package/dist/esm/Components/OptionChip/OptionChipProps.js +1 -0
- package/dist/esm/Components/OptionChip/optionInk.js +21 -0
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimeline.js +55 -0
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +1 -0
- package/dist/esm/Components/OrderSummary/OrderSummary.js +58 -0
- package/dist/esm/Components/OrderSummary/OrderSummaryProps.js +1 -0
- package/dist/esm/Components/PaymentOption/PaymentOption.js +19 -0
- package/dist/esm/Components/PaymentOption/PaymentOptionGroup.js +5 -0
- package/dist/esm/Components/PaymentOption/PaymentOptionProps.js +1 -0
- package/dist/esm/Components/PincodeChecker/PincodeChecker.js +170 -0
- package/dist/esm/Components/PincodeChecker/PincodeCheckerProps.js +1 -0
- package/dist/esm/Components/PriceBlock/PriceBlock.js +39 -0
- package/dist/esm/Components/PriceBlock/PriceBlockProps.js +1 -0
- package/dist/esm/Components/ProductBadges/ProductBadges.js +59 -0
- package/dist/esm/Components/ProductBadges/ProductBadgesProps.js +1 -0
- package/dist/esm/Components/ProductCard/ProductCard.js +105 -54
- package/dist/esm/Components/ProductCard/ProductCardAction.js +60 -0
- package/dist/esm/Components/ProductCard/ProductCardGrid.js +18 -0
- package/dist/esm/Components/ProductCard/ProductCardMedia.js +33 -0
- package/dist/esm/Components/ProductCard/ProductCardSkeleton.js +12 -0
- package/dist/esm/Components/ProductCard/ProductCardSwatches.js +35 -0
- package/dist/esm/Components/ProductCard/QuickAddSheet.js +71 -0
- package/dist/esm/Components/ProductCard/QuickAddSheetProps.js +1 -0
- package/dist/esm/Components/ProductCard/cardLabels.js +13 -0
- package/dist/esm/Components/ProductCard/cardMetrics.js +52 -0
- package/dist/esm/Components/ProductCard/productCardFixtures.js +58 -0
- package/dist/esm/Components/ProductCard/productCardModel.js +65 -0
- package/dist/esm/Components/ProductCard/useMinWidth.js +16 -0
- package/dist/esm/Components/ProductDetails/ProductDetails.js +210 -34
- package/dist/esm/Components/ProductDetails/productDetailsModel.js +35 -0
- package/dist/esm/Components/ProductDetails/useInViewport.js +14 -0
- package/dist/esm/Components/QuantityStepper/QuantityStepper.js +57 -0
- package/dist/esm/Components/QuantityStepper/QuantityStepperProps.js +1 -0
- package/dist/esm/Components/Rating/Rating.js +79 -0
- package/dist/esm/Components/Rating/RatingProps.js +1 -0
- package/dist/esm/Components/ReviewList/ReviewList.js +89 -0
- package/dist/esm/Components/ReviewList/ReviewListProps.js +1 -0
- package/dist/esm/Components/ReviewSummary/ReviewSummary.js +42 -0
- package/dist/esm/Components/ReviewSummary/ReviewSummaryProps.js +1 -0
- package/dist/esm/Components/SegmentedControl/SegmentedControl.js +19 -7
- package/dist/esm/Components/SegmentedControl/segmentedInk.js +2 -0
- package/dist/esm/Components/SegmentedControl/useSlidingPill.js +6 -1
- package/dist/esm/Components/SideBar/SecondaryBar.js +14 -9
- package/dist/esm/Components/SideBar/components/MenuItemBox.js +14 -10
- package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +4 -3
- package/dist/esm/Components/SpecTable/SpecTable.js +34 -0
- package/dist/esm/Components/SpecTable/SpecTableProps.js +1 -0
- package/dist/esm/Components/Spinner/Spinner.js +2 -2
- package/dist/esm/Components/StageProgress/StepperStage.js +2 -1
- package/dist/esm/Components/StatCard/StatCard.js +2 -2
- package/dist/esm/Components/StickyBuyBar/StickyBuyBar.js +80 -0
- package/dist/esm/Components/StickyBuyBar/StickyBuyBarProps.js +1 -0
- package/dist/esm/Components/StockStatus/StockStatus.js +29 -0
- package/dist/esm/Components/StockStatus/StockStatusProps.js +1 -0
- package/dist/esm/Components/Table/Table.js +2 -1
- package/dist/esm/Components/Table/columnLabel.js +21 -0
- package/dist/esm/Components/Table/components/TableBody.js +5 -1
- package/dist/esm/Components/Table/components/TableHeader.js +3 -2
- package/dist/esm/Components/Table/filters/ActiveFilters.js +2 -1
- package/dist/esm/Components/Table/filters/TableFilters.js +2 -1
- package/dist/esm/Components/Table/hooks/useTable.js +3 -2
- package/dist/esm/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/esm/Components/Table/settings/TableSettings.js +2 -1
- package/dist/esm/Components/TrustBadges/TrustBadges.js +22 -0
- package/dist/esm/Components/TrustBadges/TrustBadgesProps.js +1 -0
- package/dist/esm/Components/VariantSelector/VariantSelector.js +118 -0
- package/dist/esm/Components/VariantSelector/VariantSelectorProps.js +1 -0
- package/dist/esm/Components/VariantSelector/variantSelection.js +19 -0
- package/dist/esm/Components/WishlistToggle/WishlistToggle.js +63 -0
- package/dist/esm/Components/WishlistToggle/WishlistToggleProps.js +1 -0
- package/dist/esm/Theme/assertPalette.js +1 -1
- package/dist/esm/Theme/tokens/brands/index.js +2 -0
- package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +2 -0
- package/dist/esm/Theme/tokens/builders/index.js +1 -0
- package/dist/esm/Theme/tokens/builders/rechartsTheme.js +37 -0
- package/dist/esm/Theme/tokens/builders/star.js +4 -0
- package/dist/esm/Theme/useChartTheme.js +8 -0
- package/dist/esm/Utils/price.js +27 -0
- package/dist/esm/index.js +36 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +86 -4
- package/package.json +1 -1
- package/dist/Components/ProductCard/ProductLabel.d.ts +0 -7
- package/dist/Components/ProductCard/ProductLabel.js +0 -20
- package/dist/Components/ProductCard/ProductPrice.d.ts +0 -10
- package/dist/Components/ProductCard/ProductPrice.js +0 -126
- package/dist/Components/ProductCard/ProductReview.d.ts +0 -8
- package/dist/Components/ProductCard/ProductReview.js +0 -30
- package/dist/Components/ProductCard/ProductTags.d.ts +0 -8
- package/dist/Components/ProductCard/ProductTags.js +0 -53
- package/dist/Components/ProductDetails/ProductDtlPrice.d.ts +0 -7
- package/dist/Components/ProductDetails/ProductDtlPrice.js +0 -24
- package/dist/Components/ProductDetails/ProductImageSlider.d.ts +0 -13
- package/dist/Components/ProductDetails/ProductImageSlider.js +0 -240
- package/dist/esm/Components/ProductCard/ProductLabel.js +0 -18
- package/dist/esm/Components/ProductCard/ProductPrice.js +0 -121
- package/dist/esm/Components/ProductCard/ProductReview.js +0 -28
- package/dist/esm/Components/ProductCard/ProductTags.js +0 -48
- package/dist/esm/Components/ProductDetails/ProductDtlPrice.js +0 -22
- package/dist/esm/Components/ProductDetails/ProductImageSlider.js +0 -204
|
@@ -1,53 +0,0 @@
|
|
|
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 = __importDefault(require("react"));
|
|
8
|
-
const react_2 = require("@chakra-ui/react");
|
|
9
|
-
const ToolTip_1 = __importDefault(require("../ToolTip/ToolTip"));
|
|
10
|
-
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
11
|
-
const ProductTags = ({ tags, className, size = 'sm' }) => {
|
|
12
|
-
const getRows = (tags) => {
|
|
13
|
-
const count = tags.length;
|
|
14
|
-
if (count === 1)
|
|
15
|
-
return [tags];
|
|
16
|
-
if (count === 2)
|
|
17
|
-
return [tags];
|
|
18
|
-
if (count === 3)
|
|
19
|
-
return [[tags[0]], tags.slice(1)];
|
|
20
|
-
if (count === 4)
|
|
21
|
-
return [tags.slice(0, 2), tags.slice(2, 4)];
|
|
22
|
-
return [];
|
|
23
|
-
};
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(react_2.Flex, { direction: "column", gap: "1", className: className, w: "full", children: getRows(tags).map((row, rowIndex) => ((0, jsx_runtime_1.jsx)(react_2.Flex, { gap: "1", children: row.map((tag, tagIndex) => ((0, jsx_runtime_1.jsx)(Tag, { fullWidth: row.length === 1, size: size, children: tag }, tagIndex))) }, rowIndex))) }));
|
|
25
|
-
};
|
|
26
|
-
const Tag = ({ children, fullWidth = false, size = 'sm', }) => {
|
|
27
|
-
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
28
|
-
const tagText = colors.text[900];
|
|
29
|
-
const tagBorder = colors.boxborder[500];
|
|
30
|
-
// Size map for tags
|
|
31
|
-
const tagSizes = {
|
|
32
|
-
xs: { fontSize: '0.625rem', px: '0.5rem', py: '0.125rem' },
|
|
33
|
-
sm: { fontSize: '0.75rem', px: '0.6rem', py: '0.2rem' },
|
|
34
|
-
md: { fontSize: '0.875rem', px: '0.75rem', py: '0.3rem' },
|
|
35
|
-
lg: { fontSize: '0.938rem', px: '0.938rem', py: '0.4rem' },
|
|
36
|
-
};
|
|
37
|
-
const ref = react_1.default.useRef(null);
|
|
38
|
-
const [truncated, setTruncated] = react_1.default.useState(false);
|
|
39
|
-
react_1.default.useEffect(() => {
|
|
40
|
-
const el = ref.current;
|
|
41
|
-
if (!el)
|
|
42
|
-
return;
|
|
43
|
-
const check = () => setTruncated(el.scrollWidth > el.clientWidth);
|
|
44
|
-
check();
|
|
45
|
-
window.addEventListener('resize', check);
|
|
46
|
-
return () => {
|
|
47
|
-
window.removeEventListener('resize', check);
|
|
48
|
-
};
|
|
49
|
-
}, [children]);
|
|
50
|
-
const content = ((0, jsx_runtime_1.jsx)(react_2.Box, { ref: ref, flex: fullWidth ? '1' : '1', border: "0.063rem solid", borderColor: tagBorder, color: tagText, fontSize: tagSizes[size].fontSize, fontWeight: "semibold", borderRadius: "full", px: tagSizes[size].px, py: tagSizes[size].py, textAlign: "center", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", children: children }));
|
|
51
|
-
return truncated ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: String(children), hasArrow: true, openDelay: 300, placement: 'bottom', children: content })) : (content);
|
|
52
|
-
};
|
|
53
|
-
exports.default = ProductTags;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { options } from "../ProductCard/ProductCardProps";
|
|
2
|
-
interface ProductDtlPriceProps {
|
|
3
|
-
price: options[];
|
|
4
|
-
onSelect?: (option: options) => void;
|
|
5
|
-
}
|
|
6
|
-
declare const ProductDtlPrice: ({ price, onSelect }: ProductDtlPriceProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default ProductDtlPrice;
|
|
@@ -1,24 +0,0 @@
|
|
|
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 accentText_1 = require("../../Theme/tokens/builders/accentText");
|
|
8
|
-
const tone_1 = require("../../Theme/tokens/builders/tone");
|
|
9
|
-
const ProductDtlPrice = ({ price, onSelect }) => {
|
|
10
|
-
const [selectedIndex, setSelectedIndex] = (0, react_1.useState)(0);
|
|
11
|
-
const selected = price[selectedIndex];
|
|
12
|
-
const discounted = Math.round(selected.price - (selected.price * selected.offer) / 100);
|
|
13
|
-
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
14
|
-
const saveTone = (0, tone_1.resolveSoftTone)(theme.colors, theme.colors.semantic.success);
|
|
15
|
-
(0, react_1.useEffect)(() => {
|
|
16
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selected);
|
|
17
|
-
}, [selected, onSelect]);
|
|
18
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.VStack, { align: "start", spacing: 3, p: 4, borderRadius: "lg", w: "full", children: [(0, jsx_runtime_1.jsxs)(react_2.HStack, { spacing: 2, align: "center", children: [selected.offer > 0 && ((0, jsx_runtime_1.jsxs)(react_2.Text, { fontSize: "lg", color: theme.colors.textMuted, as: "s", children: ["\u20B9", selected.price] })), (0, jsx_runtime_1.jsxs)(react_2.Text, { fontSize: "xl", color: (0, accentText_1.accentTextOnCanvas)(theme.colors.red, theme.colors.backgroundColor.main), fontWeight: "bold", children: ["\u20B9", discounted] }), selected.offer > 0 && ((0, jsx_runtime_1.jsxs)(react_2.Badge, { bg: saveTone.bg, color: saveTone.fg, fontSize: "xs", borderRadius: "full", px: 2, py: 0.5, children: ["SAVE ", selected.offer, "%"] }))] }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "sm", color: theme.colors.textMuted, children: "(Incl. of all taxes)" }), (0, jsx_runtime_1.jsxs)(react_2.Box, { children: [(0, jsx_runtime_1.jsxs)(react_2.Text, { fontSize: "sm", fontWeight: "bold", textTransform: "uppercase", mb: 1, children: ["Packs : ", selected.label] }), (0, jsx_runtime_1.jsx)(react_2.HStack, { spacing: 2, children: price.map((pack, idx) => ((0, jsx_runtime_1.jsx)(react_2.Button, { size: "xs", variant: "outline", borderColor: idx === selectedIndex ? theme.colors.primary[400] : theme.colors.primary[200], bg: idx === selectedIndex ? theme.colors.primary[50] : theme.colors.background[50], color: (0, accentText_1.accentTextOnCanvas)(theme.colors.primary, idx === selectedIndex ? theme.colors.primary[50] : theme.colors.background[50]), borderRadius: "lg", fontWeight: "medium", _hover: {
|
|
19
|
-
bg: theme.colors.primary[100],
|
|
20
|
-
}, _active: {
|
|
21
|
-
bg: theme.colors.primary[100],
|
|
22
|
-
}, onClick: () => setSelectedIndex(idx), children: pack.label }, pack.var_id))) })] })] }));
|
|
23
|
-
};
|
|
24
|
-
exports.default = ProductDtlPrice;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { images } from "./ProductDetailsProps";
|
|
2
|
-
import { batch } from "../ProductCard/ProductCardProps";
|
|
3
|
-
interface ProductImageSliderProps {
|
|
4
|
-
images?: images[];
|
|
5
|
-
thumbHeight?: number;
|
|
6
|
-
imageSize?: number;
|
|
7
|
-
thumbnailsToShow?: number;
|
|
8
|
-
batch?: batch;
|
|
9
|
-
/** Used to build each image's alt text ("<name>, image 2 of 5"); falls back to "Product". */
|
|
10
|
-
productName?: string;
|
|
11
|
-
}
|
|
12
|
-
export default function ProductImageSlider({ images, thumbHeight, imageSize, thumbnailsToShow, batch, productName, }: ProductImageSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1,240 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.default = ProductImageSlider;
|
|
37
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
-
const react_1 = require("@chakra-ui/react");
|
|
39
|
-
const react_2 = __importStar(require("react"));
|
|
40
|
-
const lucide_react_1 = require("lucide-react");
|
|
41
|
-
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
42
|
-
const motion_1 = require("../../Theme/tokens/primitives/motion");
|
|
43
|
-
const accentText_1 = require("../../Theme/tokens/builders/accentText");
|
|
44
|
-
const scrim_1 = require("../../Theme/tokens/builders/scrim");
|
|
45
|
-
function ProductImageSlider({ images, thumbHeight = 60, imageSize = 480, thumbnailsToShow = 6, batch, productName = "Product", }) {
|
|
46
|
-
const [activeIndex, setActiveIndex] = (0, react_2.useState)(0);
|
|
47
|
-
const [thumbStartIndex, setThumbStartIndex] = (0, react_2.useState)(0);
|
|
48
|
-
const [transformOrigin, setTransformOrigin] = (0, react_2.useState)("center center");
|
|
49
|
-
const [isHovered, setIsHovered] = (0, react_2.useState)(false);
|
|
50
|
-
const [isPlaying, setIsPlaying] = (0, react_2.useState)(false);
|
|
51
|
-
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
52
|
-
const isMobile = (0, react_1.useBreakpointValue)({ base: true, md: false });
|
|
53
|
-
// Opaque enough that white ink clears 4.5:1/3:1 against it on any photo, not just this one.
|
|
54
|
-
const controlScrim = (0, scrim_1.overlayScrim)(theme.colors);
|
|
55
|
-
const getYouTubeId = (url) => {
|
|
56
|
-
const patterns = [
|
|
57
|
-
/youtu\.be\/([A-Za-z0-9_-]{6,})/i,
|
|
58
|
-
/youtube\.com\/watch\?[^#]*v=([A-Za-z0-9_-]{6,})/i,
|
|
59
|
-
/youtube\.com\/embed\/([A-Za-z0-9_-]{6,})/i,
|
|
60
|
-
/youtube\.com\/shorts\/([A-Za-z0-9_-]{6,})/i,
|
|
61
|
-
/youtube\.com\/live\/([A-Za-z0-9_-]{6,})/i,
|
|
62
|
-
];
|
|
63
|
-
for (const re of patterns) {
|
|
64
|
-
const m = url.match(re);
|
|
65
|
-
if (m === null || m === void 0 ? void 0 : m[1])
|
|
66
|
-
return m[1];
|
|
67
|
-
}
|
|
68
|
-
return undefined;
|
|
69
|
-
};
|
|
70
|
-
const getVimeoId = (url) => {
|
|
71
|
-
const patterns = [
|
|
72
|
-
/vimeo\.com\/(\d+)/i,
|
|
73
|
-
/player\.vimeo\.com\/video\/(\d+)/i,
|
|
74
|
-
];
|
|
75
|
-
for (const re of patterns) {
|
|
76
|
-
const m = url.match(re);
|
|
77
|
-
if (m === null || m === void 0 ? void 0 : m[1])
|
|
78
|
-
return m[1];
|
|
79
|
-
}
|
|
80
|
-
return undefined;
|
|
81
|
-
};
|
|
82
|
-
const getDailymotionId = (url) => {
|
|
83
|
-
const patterns = [
|
|
84
|
-
/dailymotion\.com\/video\/([A-Za-z0-9]+)/i,
|
|
85
|
-
/dai\.ly\/([A-Za-z0-9]+)/i,
|
|
86
|
-
];
|
|
87
|
-
for (const re of patterns) {
|
|
88
|
-
const m = url.match(re);
|
|
89
|
-
if (m === null || m === void 0 ? void 0 : m[1])
|
|
90
|
-
return m[1];
|
|
91
|
-
}
|
|
92
|
-
return undefined;
|
|
93
|
-
};
|
|
94
|
-
const isVideoUrl = (url) => /\.(mp4|webm|ogg)(\?|#|$)/i.test(url) ||
|
|
95
|
-
!!(getYouTubeId(url) || getVimeoId(url) || getDailymotionId(url));
|
|
96
|
-
const getThumbForItem = (url) => {
|
|
97
|
-
const yt = getYouTubeId(url);
|
|
98
|
-
if (yt)
|
|
99
|
-
return `https://img.youtube.com/vi/${yt}/hqdefault.jpg`;
|
|
100
|
-
const vm = getVimeoId(url);
|
|
101
|
-
if (vm)
|
|
102
|
-
return `https://vumbnail.com/${vm}.jpg`;
|
|
103
|
-
const dm = getDailymotionId(url);
|
|
104
|
-
if (dm)
|
|
105
|
-
return `https://www.dailymotion.com/thumbnail/video/${dm}`;
|
|
106
|
-
return undefined;
|
|
107
|
-
};
|
|
108
|
-
react_2.default.useEffect(() => {
|
|
109
|
-
setIsPlaying(false);
|
|
110
|
-
}, [activeIndex]);
|
|
111
|
-
const totalThumbs = (images === null || images === void 0 ? void 0 : images.length) || 0;
|
|
112
|
-
const hasMultiple = totalThumbs > 1;
|
|
113
|
-
const altFor = (index) => `${productName}, image ${index + 1} of ${totalThumbs}`;
|
|
114
|
-
const visibleThumbnails = images === null || images === void 0 ? void 0 : images.slice(thumbStartIndex, thumbStartIndex + thumbnailsToShow);
|
|
115
|
-
const canScrollUp = thumbStartIndex > 0;
|
|
116
|
-
const canScrollDown = thumbStartIndex + thumbnailsToShow < totalThumbs;
|
|
117
|
-
const handleThumbScroll = (direction) => {
|
|
118
|
-
if (direction === "up" && canScrollUp) {
|
|
119
|
-
setThumbStartIndex((prev) => {
|
|
120
|
-
const newStart = Math.max(prev - 1, 0);
|
|
121
|
-
setActiveIndex(newStart);
|
|
122
|
-
return newStart;
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
else if (direction === "down" && canScrollDown) {
|
|
126
|
-
setThumbStartIndex((prev) => {
|
|
127
|
-
const newStart = Math.min(prev + 1, totalThumbs - thumbnailsToShow);
|
|
128
|
-
setActiveIndex(newStart);
|
|
129
|
-
return newStart;
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
const updateActiveIndex = (newIndex) => {
|
|
134
|
-
setActiveIndex(newIndex);
|
|
135
|
-
// Scroll thumbnails window if active index is outside the current visible range
|
|
136
|
-
if (newIndex < thumbStartIndex) {
|
|
137
|
-
setThumbStartIndex(newIndex);
|
|
138
|
-
}
|
|
139
|
-
else if (newIndex >= thumbStartIndex + thumbnailsToShow) {
|
|
140
|
-
setThumbStartIndex(newIndex - thumbnailsToShow + 1);
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Flex, { maxW: "6xl", mx: "auto", gap: 4, direction: isMobile ? "column" : "row", children: isMobile ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_1.Box, { w: "full",
|
|
144
|
-
// h={`${imageSize}px`}
|
|
145
|
-
position: "relative", overflow: "hidden", borderRadius: "lg", boxShadow: "md", onMouseMove: (e) => {
|
|
146
|
-
if (isMobile)
|
|
147
|
-
return;
|
|
148
|
-
const bounds = e.currentTarget.getBoundingClientRect();
|
|
149
|
-
const x = ((e.clientX - bounds.left) / bounds.width) * 100;
|
|
150
|
-
const y = ((e.clientY - bounds.top) / bounds.height) * 100;
|
|
151
|
-
setTransformOrigin(`${x}% ${y}%`);
|
|
152
|
-
}, onMouseEnter: () => !isMobile && setIsHovered(true), onMouseLeave: () => {
|
|
153
|
-
setIsHovered(false);
|
|
154
|
-
setTransformOrigin("center center");
|
|
155
|
-
}, children: [(0, jsx_runtime_1.jsx)(react_1.Box, { position: "absolute", top: "2", left: "2", zIndex: "1", children: (0, jsx_runtime_1.jsx)(react_1.Badge, { colorScheme: batch === null || batch === void 0 ? void 0 : batch.color, variant: "solid", children: batch === null || batch === void 0 ? void 0 : batch.label }) }), (() => {
|
|
156
|
-
const item = images === null || images === void 0 ? void 0 : images[activeIndex];
|
|
157
|
-
const url = (item === null || item === void 0 ? void 0 : item.imageUrl) || "";
|
|
158
|
-
const isVideo = (item === null || item === void 0 ? void 0 : item.isImage) !== undefined ? item.isImage === false : isVideoUrl(url);
|
|
159
|
-
const yt = getYouTubeId(url);
|
|
160
|
-
const vimeo = getVimeoId(url);
|
|
161
|
-
const dm = getDailymotionId(url);
|
|
162
|
-
const thumb = (item === null || item === void 0 ? void 0 : item.thumb) || getThumbForItem(url);
|
|
163
|
-
if (isVideo) {
|
|
164
|
-
if (!isPlaying) {
|
|
165
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Box, { position: "relative", w: "100%", h: `${imageSize}px`, children: [(0, jsx_runtime_1.jsx)(react_1.Image, { src: thumb || url, alt: "Video thumbnail", w: "100%", h: "100%", objectFit: "cover" }), (0, jsx_runtime_1.jsx)(react_1.Flex, { position: "absolute", inset: 0, align: "center", justify: "center", children: (0, jsx_runtime_1.jsx)(react_1.Box, { bg: theme.colors.background[50], borderRadius: "full", boxShadow: "lg", p: 3, cursor: "pointer", role: "button", tabIndex: 0, "aria-label": "Play video", onClick: () => setIsPlaying(true), onKeyDown: (e) => {
|
|
166
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
167
|
-
e.preventDefault();
|
|
168
|
-
setIsPlaying(true);
|
|
169
|
-
}
|
|
170
|
-
}, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Play, { size: 24, color: (0, accentText_1.accentTextOnCanvas)(theme.colors.primary, theme.colors.background[50]) }) }) })] }));
|
|
171
|
-
}
|
|
172
|
-
return yt ? ((0, jsx_runtime_1.jsx)(react_1.AspectRatio, { ratio: 16 / 9, w: "100%", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: "iframe", src: `https://www.youtube.com/embed/${yt}?rel=0&autoplay=1`, allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture", allowFullScreen: true, border: "0" }) })) : vimeo ? ((0, jsx_runtime_1.jsx)(react_1.AspectRatio, { ratio: 16 / 9, w: "100%", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: "iframe", src: `https://player.vimeo.com/video/${vimeo}?autoplay=1`, allow: "autoplay; fullscreen; picture-in-picture", allowFullScreen: true, border: "0" }) })) : dm ? ((0, jsx_runtime_1.jsx)(react_1.AspectRatio, { ratio: 16 / 9, w: "100%", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: "iframe", src: `https://www.dailymotion.com/embed/video/${dm}?autoplay=1`, allow: "autoplay; fullscreen; picture-in-picture", allowFullScreen: true, border: "0" }) })) : ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "video", src: url, w: "100%", h: `${imageSize}px`, controls: true, autoPlay: true, sx: { objectFit: "contain", backgroundColor: "black" } }));
|
|
173
|
-
}
|
|
174
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Image, { src: url, alt: altFor(activeIndex), w: "100%", h: "100%", objectFit: "cover", transformOrigin: transformOrigin, transform: !isMobile && isHovered ? "scale(1.6)" : "scale(1)", transition: "transform 0.3s ease" }));
|
|
175
|
-
})(), hasMultiple && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.IconButton, { icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { size: 20, color: theme.colors.white }), "aria-label": "Previous", onClick: () => {
|
|
176
|
-
var _a;
|
|
177
|
-
const max = ((_a = images === null || images === void 0 ? void 0 : images.length) !== null && _a !== void 0 ? _a : 1);
|
|
178
|
-
const newIndex = activeIndex === 0 ? max - 1 : activeIndex - 1;
|
|
179
|
-
updateActiveIndex(newIndex);
|
|
180
|
-
}, position: "absolute", left: "2", top: "50%", transform: "translateY(-50%)", variant: "solid", isRound: true, bg: controlScrim, _hover: { transform: "translateY(-50%) scale(1.08)", bg: controlScrim }, _active: { bg: controlScrim } }), (0, jsx_runtime_1.jsx)(react_1.IconButton, { icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 20, color: theme.colors.white }), "aria-label": "Next", onClick: () => {
|
|
181
|
-
var _a;
|
|
182
|
-
const max = ((_a = images === null || images === void 0 ? void 0 : images.length) !== null && _a !== void 0 ? _a : 1);
|
|
183
|
-
const newIndex = activeIndex === max - 1 ? 0 : activeIndex + 1;
|
|
184
|
-
updateActiveIndex(newIndex);
|
|
185
|
-
}, position: "absolute", right: "2", top: "50%", transform: "translateY(-50%)", variant: "solid", isRound: true, bg: controlScrim, _hover: { transform: "translateY(-50%) scale(1.08)", bg: controlScrim }, _active: { bg: controlScrim } })] }))] }), hasMultiple && ((0, jsx_runtime_1.jsxs)(react_1.HStack, { spacing: 2, align: "center", justify: "center", children: [(0, jsx_runtime_1.jsx)(react_1.IconButton, { icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { size: 16, color: theme.colors.textMuted }), "aria-label": "Scroll Left", onClick: () => handleThumbScroll("up"), isDisabled: !canScrollUp, variant: "ghost", size: "sm" }), visibleThumbnails === null || visibleThumbnails === void 0 ? void 0 : visibleThumbnails.map((src, index) => {
|
|
186
|
-
const actualIndex = thumbStartIndex + index;
|
|
187
|
-
const url = src.imageUrl;
|
|
188
|
-
const isVideo = src.isImage !== undefined ? src.isImage === false : isVideoUrl(url);
|
|
189
|
-
const thumb = src.thumb || getThumbForItem(url);
|
|
190
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Box, { w: `${thumbHeight}px`, h: `${thumbHeight}px`, borderRadius: "lg", overflow: "hidden", cursor: "pointer", border: actualIndex === activeIndex
|
|
191
|
-
? `0.063rem solid ${theme.colors.primary[500]}`
|
|
192
|
-
: "0.125rem solid transparent", opacity: actualIndex === activeIndex ? 1 : 0.5, onClick: () => setActiveIndex(actualIndex), _hover: { opacity: 1 }, transition: (0, motion_1.transitionFor)(["background-color", "transform"], "base"), position: "relative", children: isVideo ? (thumb ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Image, { src: thumb, alt: "Video thumbnail", w: "100%", h: "100%", objectFit: "cover" }), (0, jsx_runtime_1.jsx)(react_1.Flex, { position: "absolute", inset: 0, align: "center", justify: "center", pointerEvents: "none", children: (0, jsx_runtime_1.jsx)(react_1.Box, { bg: theme.colors.background[50], borderRadius: "full", boxShadow: "md", p: 1.5, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Play, { size: 14, color: (0, accentText_1.accentTextOnCanvas)(theme.colors.primary, theme.colors.background[50]) }) }) })] })) : ((0, jsx_runtime_1.jsx)(react_1.Flex, { w: "100%", h: "100%", align: "center", justify: "center", bg: theme.colors.backgroundColor.subtle, children: (0, jsx_runtime_1.jsx)(react_1.Box, { bg: theme.colors.background[50], borderRadius: "full", boxShadow: "md", p: 1.5, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Play, { size: 14, color: (0, accentText_1.accentTextOnCanvas)(theme.colors.primary, theme.colors.background[50]) }) }) }))) : ((0, jsx_runtime_1.jsx)(react_1.Image, { src: url, alt: altFor(actualIndex), w: "100%", h: "100%", objectFit: "cover" })) }, actualIndex));
|
|
193
|
-
}), (0, jsx_runtime_1.jsx)(react_1.IconButton, { icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 16, color: theme.colors.textMuted }), "aria-label": "Scroll Right", onClick: () => handleThumbScroll("down"), isDisabled: !canScrollDown, variant: "ghost", size: "sm" })] }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [hasMultiple && ((0, jsx_runtime_1.jsxs)(react_1.Box, { w: `${thumbHeight}px`, h: `${thumbHeight * thumbnailsToShow}px`, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "space-between", borderRadius: "lg", overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(react_1.IconButton, { icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronUp, { size: 16, color: theme.colors.textMuted }), "aria-label": "Scroll Up", onClick: () => handleThumbScroll("up"), isDisabled: !canScrollUp, variant: "ghost", size: "sm", m: 1 }), (0, jsx_runtime_1.jsx)(react_1.VStack, { spacing: 2, flex: "1", overflow: "hidden", children: visibleThumbnails === null || visibleThumbnails === void 0 ? void 0 : visibleThumbnails.map((src, index) => {
|
|
194
|
-
const actualIndex = thumbStartIndex + index;
|
|
195
|
-
const url = src.imageUrl;
|
|
196
|
-
const isVideo = src.isImage !== undefined ? src.isImage === false : isVideoUrl(url);
|
|
197
|
-
const thumb = src.thumb || getThumbForItem(url);
|
|
198
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Box, { w: `${thumbHeight}px`, h: `${thumbHeight}px`, borderRadius: "lg", overflow: "hidden", cursor: "pointer", border: actualIndex === activeIndex
|
|
199
|
-
? `0.063rem solid ${theme.colors.primary[500]}`
|
|
200
|
-
: "0.125rem solid transparent", opacity: actualIndex === activeIndex ? 1 : 0.5, onClick: () => setActiveIndex(actualIndex), _hover: { opacity: 1 }, transition: (0, motion_1.transitionFor)(["background-color", "transform"], "base"), position: "relative", children: isVideo ? (thumb ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Image, { src: thumb, w: "100%", h: "100%", objectFit: "cover", alt: "Video thumbnail" }), (0, jsx_runtime_1.jsx)(react_1.Flex, { position: "absolute", inset: 0, align: "center", justify: "center", pointerEvents: "none", children: (0, jsx_runtime_1.jsx)(react_1.Box, { bg: theme.colors.background[50], borderRadius: "full", boxShadow: "md", p: 1.5, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Play, { size: 14, color: (0, accentText_1.accentTextOnCanvas)(theme.colors.primary, theme.colors.background[50]) }) }) })] })) : ((0, jsx_runtime_1.jsx)(react_1.Flex, { w: "100%", h: "100%", align: "center", justify: "center", bg: theme.colors.backgroundColor.subtle, children: (0, jsx_runtime_1.jsx)(react_1.Box, { bg: theme.colors.background[50], borderRadius: "full", boxShadow: "md", p: 1.5, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Play, { size: 14, color: (0, accentText_1.accentTextOnCanvas)(theme.colors.primary, theme.colors.background[50]) }) }) }))) : ((0, jsx_runtime_1.jsx)(react_1.Image, { src: url, w: "100%", h: "100%", objectFit: "cover", alt: altFor(actualIndex) })) }, actualIndex));
|
|
201
|
-
}) }), (0, jsx_runtime_1.jsx)(react_1.IconButton, { icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: 16, color: theme.colors.textMuted }), "aria-label": "Scroll Down", onClick: () => handleThumbScroll("down"), isDisabled: !canScrollDown, variant: "ghost", size: "sm", m: 1 })] })), (0, jsx_runtime_1.jsxs)(react_1.Box, { w: `${imageSize}px`, h: `${imageSize}px`, position: "relative", overflow: "hidden", borderRadius: "lg", boxShadow: "md", onMouseMove: (e) => {
|
|
202
|
-
const bounds = e.currentTarget.getBoundingClientRect();
|
|
203
|
-
const x = ((e.clientX - bounds.left) / bounds.width) * 100;
|
|
204
|
-
const y = ((e.clientY - bounds.top) / bounds.height) * 100;
|
|
205
|
-
setTransformOrigin(`${x}% ${y}%`);
|
|
206
|
-
}, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => {
|
|
207
|
-
setIsHovered(false);
|
|
208
|
-
setTransformOrigin("center center");
|
|
209
|
-
}, children: [(0, jsx_runtime_1.jsx)(react_1.Box, { position: "absolute", top: "2", left: "2", zIndex: "1", children: (0, jsx_runtime_1.jsx)(react_1.Badge, { colorScheme: batch === null || batch === void 0 ? void 0 : batch.color, variant: "solid", children: batch === null || batch === void 0 ? void 0 : batch.label }) }), (() => {
|
|
210
|
-
const item = images === null || images === void 0 ? void 0 : images[activeIndex];
|
|
211
|
-
const url = (item === null || item === void 0 ? void 0 : item.imageUrl) || "";
|
|
212
|
-
const isVideo = (item === null || item === void 0 ? void 0 : item.isImage) !== undefined ? item.isImage === false : isVideoUrl(url);
|
|
213
|
-
const yt = getYouTubeId(url);
|
|
214
|
-
const vimeo = getVimeoId(url);
|
|
215
|
-
const dm = getDailymotionId(url);
|
|
216
|
-
const thumb = (item === null || item === void 0 ? void 0 : item.thumb) || getThumbForItem(url);
|
|
217
|
-
if (isVideo) {
|
|
218
|
-
if (!isPlaying) {
|
|
219
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Box, { position: "relative", w: "100%", h: `${imageSize}px`, children: [(0, jsx_runtime_1.jsx)(react_1.Image, { src: thumb || url, alt: "Video thumbnail", w: "100%", h: "100%", objectFit: "cover" }), (0, jsx_runtime_1.jsx)(react_1.Flex, { position: "absolute", inset: 0, align: "center", justify: "center", children: (0, jsx_runtime_1.jsx)(react_1.Box, { bg: theme.colors.background[50], borderRadius: "full", boxShadow: "lg", p: 3, cursor: "pointer", role: "button", tabIndex: 0, "aria-label": "Play video", onClick: () => setIsPlaying(true), onKeyDown: (e) => {
|
|
220
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
221
|
-
e.preventDefault();
|
|
222
|
-
setIsPlaying(true);
|
|
223
|
-
}
|
|
224
|
-
}, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Play, { size: 24, color: (0, accentText_1.accentTextOnCanvas)(theme.colors.primary, theme.colors.background[50]) }) }) })] }));
|
|
225
|
-
}
|
|
226
|
-
return yt ? ((0, jsx_runtime_1.jsx)(react_1.AspectRatio, { ratio: 16 / 9, w: "100%", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: "iframe", src: `https://www.youtube.com/embed/${yt}?rel=0&autoplay=1`, allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture", allowFullScreen: true, border: "0" }) })) : vimeo ? ((0, jsx_runtime_1.jsx)(react_1.AspectRatio, { ratio: 16 / 9, w: "100%", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: "iframe", src: `https://player.vimeo.com/video/${vimeo}?autoplay=1`, allow: "autoplay; fullscreen; picture-in-picture", allowFullScreen: true, border: "0" }) })) : dm ? ((0, jsx_runtime_1.jsx)(react_1.AspectRatio, { ratio: 16 / 9, w: "100%", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: "iframe", src: `https://www.dailymotion.com/embed/video/${dm}?autoplay=1`, allow: "autoplay; fullscreen; picture-in-picture", allowFullScreen: true, border: "0" }) })) : ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "video", src: url, w: "100%", h: `${imageSize}px`, controls: true, autoPlay: true, sx: { objectFit: "contain", backgroundColor: "black" } }));
|
|
227
|
-
}
|
|
228
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Image, { src: url, alt: altFor(activeIndex), w: "100%", h: "100%", objectFit: "cover", transformOrigin: transformOrigin, transform: isHovered ? "scale(1.6)" : "scale(1)", transition: "transform 0.3s ease", cursor: isHovered ? "zoom-in" : "default" }));
|
|
229
|
-
})(), hasMultiple && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.IconButton, { icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { size: 20, color: theme.colors.white }), "aria-label": "Previous", onClick: () => {
|
|
230
|
-
var _a;
|
|
231
|
-
const max = ((_a = images === null || images === void 0 ? void 0 : images.length) !== null && _a !== void 0 ? _a : 1);
|
|
232
|
-
const newIndex = activeIndex === 0 ? max - 1 : activeIndex - 1;
|
|
233
|
-
updateActiveIndex(newIndex);
|
|
234
|
-
}, position: "absolute", left: "2", top: "50%", transform: "translateY(-50%)", variant: "solid", isRound: true, bg: controlScrim, _hover: { transform: "translateY(-50%) scale(1.08)", bg: controlScrim }, _active: { bg: controlScrim } }), (0, jsx_runtime_1.jsx)(react_1.IconButton, { icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 20, color: theme.colors.white }), "aria-label": "Next", onClick: () => {
|
|
235
|
-
var _a;
|
|
236
|
-
const max = ((_a = images === null || images === void 0 ? void 0 : images.length) !== null && _a !== void 0 ? _a : 1);
|
|
237
|
-
const newIndex = activeIndex === max - 1 ? 0 : activeIndex + 1;
|
|
238
|
-
updateActiveIndex(newIndex);
|
|
239
|
-
}, position: "absolute", right: "2", top: "50%", transform: "translateY(-50%)", variant: "solid", isRound: true, bg: controlScrim, _hover: { transform: "translateY(-50%) scale(1.08)", bg: controlScrim }, _active: { bg: controlScrim } })] }))] })] })) }));
|
|
240
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text } from '@chakra-ui/react';
|
|
3
|
-
const ProductLabel = ({ label, description, size }) => {
|
|
4
|
-
const fontSizes = {
|
|
5
|
-
xs: "md",
|
|
6
|
-
sm: "lg",
|
|
7
|
-
md: "xl",
|
|
8
|
-
lg: "2xl"
|
|
9
|
-
};
|
|
10
|
-
const descriptionSizes = {
|
|
11
|
-
xs: 'xs',
|
|
12
|
-
sm: 'sm',
|
|
13
|
-
md: 'md',
|
|
14
|
-
lg: 'lg',
|
|
15
|
-
};
|
|
16
|
-
return (_jsxs(Box, { children: [_jsx(Text, { fontWeight: "bold", fontSize: fontSizes[size], children: label }), description && _jsx(Text, { fontSize: descriptionSizes[size], fontStyle: "italic", children: description })] }));
|
|
17
|
-
};
|
|
18
|
-
export default ProductLabel;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useState, useEffect } from 'react';
|
|
3
|
-
import { Box, Text, Portal, useOutsideClick, Flex, Grid, HStack, Badge, useBreakpointValue, } from '@chakra-ui/react';
|
|
4
|
-
import OverflowTooltipText from '../SideBar/components/OverflowTooltipText.js';
|
|
5
|
-
import { useCustomTheme } from '../../Theme/useCustomTheme.js';
|
|
6
|
-
import { accentTextOnCanvas } from '../../Theme/tokens/builders/accentText.js';
|
|
7
|
-
import { rafThrottle } from '../../Utils/rafThrottle.js';
|
|
8
|
-
import { transitionFor } from '../../Theme/tokens/primitives/motion.js';
|
|
9
|
-
const sizeConfig = {
|
|
10
|
-
xs: {
|
|
11
|
-
font: "xs",
|
|
12
|
-
label: "sm",
|
|
13
|
-
price: "sm",
|
|
14
|
-
px: 2,
|
|
15
|
-
py: 1,
|
|
16
|
-
rowHeight: "2rem",
|
|
17
|
-
iconSize: "0.75rem",
|
|
18
|
-
dotSize: "0.375rem",
|
|
19
|
-
},
|
|
20
|
-
sm: {
|
|
21
|
-
font: "sm",
|
|
22
|
-
label: "md",
|
|
23
|
-
price: "md",
|
|
24
|
-
px: 3,
|
|
25
|
-
py: 1.5,
|
|
26
|
-
rowHeight: "2.5rem",
|
|
27
|
-
iconSize: "1rem",
|
|
28
|
-
dotSize: "0.5rem",
|
|
29
|
-
},
|
|
30
|
-
md: {
|
|
31
|
-
font: "md",
|
|
32
|
-
label: "lg",
|
|
33
|
-
price: "lg",
|
|
34
|
-
px: 4,
|
|
35
|
-
py: 2,
|
|
36
|
-
rowHeight: "3rem",
|
|
37
|
-
iconSize: "1.25rem",
|
|
38
|
-
dotSize: "0.625rem",
|
|
39
|
-
},
|
|
40
|
-
lg: {
|
|
41
|
-
font: "lg",
|
|
42
|
-
label: "xl",
|
|
43
|
-
price: "xl",
|
|
44
|
-
px: 5,
|
|
45
|
-
py: 2.5,
|
|
46
|
-
rowHeight: "3.5rem",
|
|
47
|
-
iconSize: "1.5rem",
|
|
48
|
-
dotSize: "0.75rem",
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
const ProductPrice = ({ options, size, onSelect, rightSlot }) => {
|
|
52
|
-
const cfg = sizeConfig[size];
|
|
53
|
-
const theme = useCustomTheme();
|
|
54
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
55
|
-
const [selected, setSelected] = useState(options[0]);
|
|
56
|
-
const [dropdownPosition, setDropdownPosition] = useState({ top: 0, left: 0, width: 0 });
|
|
57
|
-
const buttonRef = useRef(null);
|
|
58
|
-
const dropdownRef = useRef(null);
|
|
59
|
-
const isSingleOption = options.length === 1;
|
|
60
|
-
const isMobile = useBreakpointValue({ base: true, md: false });
|
|
61
|
-
useOutsideClick({
|
|
62
|
-
ref: dropdownRef,
|
|
63
|
-
handler: () => setIsOpen(false),
|
|
64
|
-
});
|
|
65
|
-
const getDiscountedPrice = (option) => Math.round(option.price - (option.price * option.offer) / 100);
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
const updatePosition = () => {
|
|
68
|
-
if (buttonRef.current) {
|
|
69
|
-
const rect = buttonRef.current.getBoundingClientRect();
|
|
70
|
-
setDropdownPosition({
|
|
71
|
-
top: rect.bottom + 4,
|
|
72
|
-
left: rect.left,
|
|
73
|
-
width: rect.width
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
if (!isOpen)
|
|
78
|
-
return;
|
|
79
|
-
updatePosition();
|
|
80
|
-
const onReposition = rafThrottle(updatePosition);
|
|
81
|
-
window.addEventListener("resize", onReposition);
|
|
82
|
-
window.addEventListener("scroll", onReposition, {
|
|
83
|
-
capture: true, // every scrollable ancestor, not just the window
|
|
84
|
-
passive: true,
|
|
85
|
-
});
|
|
86
|
-
return () => {
|
|
87
|
-
onReposition.cancel();
|
|
88
|
-
window.removeEventListener("resize", onReposition);
|
|
89
|
-
window.removeEventListener("scroll", onReposition, true);
|
|
90
|
-
};
|
|
91
|
-
}, [isOpen]);
|
|
92
|
-
useEffect(() => {
|
|
93
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selected);
|
|
94
|
-
}, [selected, onSelect]);
|
|
95
|
-
return (_jsxs(_Fragment, { children: [isSingleOption ? (_jsx(Box, { border: "0.063rem solid", borderColor: theme.colors.primary[300], bg: theme.colors.primary[50], px: cfg.px, rounded: "lg", display: "inline-block", w: "100%", children: _jsx(Text, { fontSize: cfg.label, fontWeight: "medium", children: options[0].label }) })) : (_jsxs(Box, { ref: buttonRef, role: "button", tabIndex: 0, "aria-haspopup": "listbox", "aria-expanded": isOpen, onClick: () => setIsOpen(!isOpen), onKeyDown: (e) => {
|
|
96
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
97
|
-
e.preventDefault();
|
|
98
|
-
setIsOpen((prev) => !prev);
|
|
99
|
-
}
|
|
100
|
-
else if (e.key === "Escape") {
|
|
101
|
-
setIsOpen(false);
|
|
102
|
-
}
|
|
103
|
-
}, border: "0.063rem solid", borderColor: theme.colors.primary[300], bg: theme.colors.primary[50], px: cfg.px, rounded: "lg", cursor: "pointer", display: "flex", justifyContent: "space-between", alignItems: "center", w: "100%", children: [_jsx(Box, { flex: "1", minW: 0, children: _jsx(OverflowTooltipText, { placement: "top", maxWidth: "100%", fontSize: cfg.label, fontWeight: "medium", whiteSpace: "nowrap", children: selected.label }) }), _jsx(Text, { "aria-hidden": "true", fontSize: cfg.font, color: accentTextOnCanvas(theme.colors.primary, theme.colors.primary[50]), transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)', transition: transitionFor(["transform"]), children: "\u25BE" })] })), !isSingleOption && isOpen && (_jsx(Portal, { children: _jsx(Box, { ref: dropdownRef, role: "listbox", position: "fixed", top: `${dropdownPosition.top}px`, left: `${dropdownPosition.left}px`, width: `${dropdownPosition.width}px`, bg: theme.colors.background[50], border: "0.063rem solid", borderColor: theme.colors.primary[300], borderRadius: "xl", overflow: "hidden", maxH: "13rem", overflowY: "auto", shadow: "md", zIndex: 100000, children: options.map((option) => {
|
|
104
|
-
const discounted = getDiscountedPrice(option);
|
|
105
|
-
const isSelected = selected.var_id === option.var_id;
|
|
106
|
-
return (_jsxs(Grid, { role: "option", "aria-selected": isSelected, tabIndex: 0, px: 1, py: 0.5, cursor: "pointer", bg: isSelected ? theme.colors.primary[50] : theme.colors.background[50], borderLeft: isSelected ? '0.25rem solid' : '0.25rem solid transparent', borderLeftColor: isSelected ? theme.colors.primary[300] : "transparent", _hover: { bg: theme.colors.primary[100] }, onClick: () => {
|
|
107
|
-
setSelected(option);
|
|
108
|
-
setIsOpen(false);
|
|
109
|
-
}, onKeyDown: (e) => {
|
|
110
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
111
|
-
e.preventDefault();
|
|
112
|
-
setSelected(option);
|
|
113
|
-
setIsOpen(false);
|
|
114
|
-
}
|
|
115
|
-
}, templateColumns: { base: '1fr auto', md: '1fr auto' },
|
|
116
|
-
// columnGap={{ base: 2, md: 3 }}
|
|
117
|
-
// rowGap={{ base: 1.5, md: 2 }}
|
|
118
|
-
alignItems: "center", children: [_jsx(HStack, { gridColumn: 1, gridRow: 1, spacing: 2, align: "center", minW: 0, mb: 0, children: _jsx(Box, { flex: "1", minW: 0, children: _jsx(OverflowTooltipText, { placement: "top", maxWidth: "100%", fontSize: { base: "xs", md: "sm" }, fontWeight: "medium", whiteSpace: "nowrap", children: option.label }) }) }), _jsx(Box, { gridColumn: 1, gridRow: 2, mt: 0, textAlign: "left", children: _jsxs(HStack, { spacing: 2, align: "center", children: [option.offer > 0 && (_jsx(Badge, { bg: theme.colors.green[100], color: accentTextOnCanvas(theme.colors.green, theme.colors.green[100]), borderRadius: "full", px: { base: 0, md: 0.5 }, py: { base: 0, md: 0.25 }, fontWeight: "bold", fontSize: "11px", flexShrink: 0, children: isMobile ? `${option.offer}%` : `${option.offer}% OFF` })), _jsxs(Text, { fontSize: "sm", fontWeight: "bold", color: accentTextOnCanvas(theme.colors.red, isSelected ? theme.colors.red[50] : theme.colors.background[50]), whiteSpace: "nowrap", children: ["\u20B9", discounted] }), option.offer > 0 && (_jsxs(Text, { fontSize: "xs", color: theme.colors.textMuted, textDecoration: "line-through", whiteSpace: "nowrap", children: ["\u20B9", option.price] }))] }) }), _jsx(Box, { gridColumn: 2, gridRow: 1, ml: { base: 0, md: 0 }, justifySelf: "end", w: { base: "0.625rem", md: "0.75rem" }, h: { base: "0.625rem", md: "0.75rem" }, minW: { base: "0.625rem", md: "0.75rem" }, borderRadius: "full", border: "0.063rem solid", borderColor: isSelected ? theme.colors.primary[500] : theme.colors.boxborder[500], bg: theme.colors.background[50], display: "flex", alignItems: "center", justifyContent: "center", boxShadow: "none", children: isSelected && (_jsx(Box, { w: { base: "0.25rem", md: "0.3125rem" }, h: { base: "0.25rem", md: "0.3125rem" }, bg: theme.colors.primary[500], borderRadius: "full" })) })] }, option.var_id));
|
|
119
|
-
}) }) })), _jsxs(Flex, { mt: 2, w: "full", gap: 3, direction: { base: "column", md: "row" }, align: { base: "flex-start", md: "center" }, justify: { base: "flex-start", md: rightSlot ? "space-between" : "flex-start" }, children: [_jsxs(Box, { display: "flex", alignItems: "center", fontSize: cfg.price, gap: 2, minW: 0, children: [selected.offer > 0 && (_jsxs(Text, { color: theme.colors.textMuted, textDecoration: "line-through", children: ["\u20B9", selected.price] })), _jsxs(Text, { color: accentTextOnCanvas(theme.colors.red, theme.colors.backgroundColor.main), fontWeight: "semibold", children: ["\u20B9", getDiscountedPrice(selected)] })] }), rightSlot && (_jsx(Box, { flexShrink: 0, mt: { base: 2, md: 0 }, children: rightSlot }))] })] }));
|
|
120
|
-
};
|
|
121
|
-
export default ProductPrice;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Flex, Text, Icon } from '@chakra-ui/react';
|
|
3
|
-
import { BookCheck, Star } from 'lucide-react';
|
|
4
|
-
import { useCustomTheme } from '../../Theme/useCustomTheme.js';
|
|
5
|
-
import { accentTextOnCanvas } from '../../Theme/tokens/builders/accentText.js';
|
|
6
|
-
import { contrastRatio } from '../../Theme/tokens/builders/color.js';
|
|
7
|
-
import { AA_NON_TEXT } from '../../Theme/tokens/builders/outlineRung.js';
|
|
8
|
-
import { neutralTokens } from '../../Theme/tokens/brands/neutrals.js';
|
|
9
|
-
// The theme's `yellow` scale reverses index roles in dark mode (like every utility hue), so
|
|
10
|
-
// pulling it through the theme would silently flip this decorative "filled star" from gold to
|
|
11
|
-
// pale. A rating star is a universal, brand-independent gold — not something that should follow
|
|
12
|
-
// canvas/mode — so it's pinned here instead. Needs a design-token addition (a mode-stable
|
|
13
|
-
// "rating gold") to pixelize-design-library if this pattern is needed elsewhere.
|
|
14
|
-
const RATING_STAR_FILL = neutralTokens.yellow[500];
|
|
15
|
-
const ProductReview = ({ rating, reviewCount, mb = 0 }) => {
|
|
16
|
-
const { colors } = useCustomTheme();
|
|
17
|
-
const hasRating = rating !== undefined && rating !== null;
|
|
18
|
-
const hasReviewCount = reviewCount !== undefined && reviewCount !== null;
|
|
19
|
-
// Convert rating to number and ensure it's between 0 and 5
|
|
20
|
-
// Calculate fill percentage: (rating / 5) * 100%
|
|
21
|
-
const numericRating = hasRating ? Math.min(Math.max(Number(rating), 0), 5) : 0;
|
|
22
|
-
const fillPercentage = (numericRating / 6) * 100;
|
|
23
|
-
const chipBg = colors.teal[50];
|
|
24
|
-
const chipInk = accentTextOnCanvas(colors.teal, chipBg);
|
|
25
|
-
const starFill = contrastRatio(RATING_STAR_FILL, chipBg) >= AA_NON_TEXT ? RATING_STAR_FILL : chipInk;
|
|
26
|
-
return (_jsxs(Flex, { align: "center", gap: 2, mb: mb, children: [hasRating && (_jsxs(Flex, { align: "center", gap: 1, bg: chipBg, color: chipInk, px: 2, borderRadius: "full", children: [_jsxs(Box, { position: "relative", flexShrink: 0, display: "inline-block", width: "14px", height: "14px", lineHeight: 0, children: [_jsx(Box, { position: "absolute", top: 0, left: 0, width: "14px", height: "14px", children: _jsx(Star, { size: 14, fill: "none", strokeWidth: 1.5 }) }), fillPercentage > 0 && (_jsx(Box, { position: "absolute", top: 0, left: 0, width: `${fillPercentage}%`, height: "100%", overflow: "hidden", children: _jsx(Star, { size: 14, color: starFill, fill: starFill }) }))] }), _jsx(Text, { fontSize: "sm", fontWeight: "bold", children: numericRating })] })), hasRating && hasReviewCount && _jsx(Box, { h: "4", w: "0.063rem", bg: colors.boxborder[500] }), hasReviewCount && (_jsxs(Flex, { align: "center", gap: "1", children: [_jsx(Icon, { as: BookCheck, boxSize: 3.5 }), _jsxs(Text, { fontSize: "sm", color: colors.textMuted, children: ["(", reviewCount, ")"] })] }))] }));
|
|
27
|
-
};
|
|
28
|
-
export default ProductReview;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Box, Flex } from '@chakra-ui/react';
|
|
4
|
-
import ToolTip from '../ToolTip/ToolTip.js';
|
|
5
|
-
import { useCustomTheme } from '../../Theme/useCustomTheme.js';
|
|
6
|
-
const ProductTags = ({ tags, className, size = 'sm' }) => {
|
|
7
|
-
const getRows = (tags) => {
|
|
8
|
-
const count = tags.length;
|
|
9
|
-
if (count === 1)
|
|
10
|
-
return [tags];
|
|
11
|
-
if (count === 2)
|
|
12
|
-
return [tags];
|
|
13
|
-
if (count === 3)
|
|
14
|
-
return [[tags[0]], tags.slice(1)];
|
|
15
|
-
if (count === 4)
|
|
16
|
-
return [tags.slice(0, 2), tags.slice(2, 4)];
|
|
17
|
-
return [];
|
|
18
|
-
};
|
|
19
|
-
return (_jsx(Flex, { direction: "column", gap: "1", className: className, w: "full", children: getRows(tags).map((row, rowIndex) => (_jsx(Flex, { gap: "1", children: row.map((tag, tagIndex) => (_jsx(Tag, { fullWidth: row.length === 1, size: size, children: tag }, tagIndex))) }, rowIndex))) }));
|
|
20
|
-
};
|
|
21
|
-
const Tag = ({ children, fullWidth = false, size = 'sm', }) => {
|
|
22
|
-
const { colors } = useCustomTheme();
|
|
23
|
-
const tagText = colors.text[900];
|
|
24
|
-
const tagBorder = colors.boxborder[500];
|
|
25
|
-
// Size map for tags
|
|
26
|
-
const tagSizes = {
|
|
27
|
-
xs: { fontSize: '0.625rem', px: '0.5rem', py: '0.125rem' },
|
|
28
|
-
sm: { fontSize: '0.75rem', px: '0.6rem', py: '0.2rem' },
|
|
29
|
-
md: { fontSize: '0.875rem', px: '0.75rem', py: '0.3rem' },
|
|
30
|
-
lg: { fontSize: '0.938rem', px: '0.938rem', py: '0.4rem' },
|
|
31
|
-
};
|
|
32
|
-
const ref = React.useRef(null);
|
|
33
|
-
const [truncated, setTruncated] = React.useState(false);
|
|
34
|
-
React.useEffect(() => {
|
|
35
|
-
const el = ref.current;
|
|
36
|
-
if (!el)
|
|
37
|
-
return;
|
|
38
|
-
const check = () => setTruncated(el.scrollWidth > el.clientWidth);
|
|
39
|
-
check();
|
|
40
|
-
window.addEventListener('resize', check);
|
|
41
|
-
return () => {
|
|
42
|
-
window.removeEventListener('resize', check);
|
|
43
|
-
};
|
|
44
|
-
}, [children]);
|
|
45
|
-
const content = (_jsx(Box, { ref: ref, flex: fullWidth ? '1' : '1', border: "0.063rem solid", borderColor: tagBorder, color: tagText, fontSize: tagSizes[size].fontSize, fontWeight: "semibold", borderRadius: "full", px: tagSizes[size].px, py: tagSizes[size].py, textAlign: "center", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", children: children }));
|
|
46
|
-
return truncated ? (_jsx(ToolTip, { label: String(children), hasArrow: true, openDelay: 300, placement: 'bottom', children: content })) : (content);
|
|
47
|
-
};
|
|
48
|
-
export default ProductTags;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from "react";
|
|
3
|
-
import { Box, Text, HStack, Badge, Button, VStack, } from "@chakra-ui/react";
|
|
4
|
-
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
5
|
-
import { accentTextOnCanvas } from "../../Theme/tokens/builders/accentText.js";
|
|
6
|
-
import { resolveSoftTone } from "../../Theme/tokens/builders/tone.js";
|
|
7
|
-
const ProductDtlPrice = ({ price, onSelect }) => {
|
|
8
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
9
|
-
const selected = price[selectedIndex];
|
|
10
|
-
const discounted = Math.round(selected.price - (selected.price * selected.offer) / 100);
|
|
11
|
-
const theme = useCustomTheme();
|
|
12
|
-
const saveTone = resolveSoftTone(theme.colors, theme.colors.semantic.success);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selected);
|
|
15
|
-
}, [selected, onSelect]);
|
|
16
|
-
return (_jsxs(VStack, { align: "start", spacing: 3, p: 4, borderRadius: "lg", w: "full", children: [_jsxs(HStack, { spacing: 2, align: "center", children: [selected.offer > 0 && (_jsxs(Text, { fontSize: "lg", color: theme.colors.textMuted, as: "s", children: ["\u20B9", selected.price] })), _jsxs(Text, { fontSize: "xl", color: accentTextOnCanvas(theme.colors.red, theme.colors.backgroundColor.main), fontWeight: "bold", children: ["\u20B9", discounted] }), selected.offer > 0 && (_jsxs(Badge, { bg: saveTone.bg, color: saveTone.fg, fontSize: "xs", borderRadius: "full", px: 2, py: 0.5, children: ["SAVE ", selected.offer, "%"] }))] }), _jsx(Text, { fontSize: "sm", color: theme.colors.textMuted, children: "(Incl. of all taxes)" }), _jsxs(Box, { children: [_jsxs(Text, { fontSize: "sm", fontWeight: "bold", textTransform: "uppercase", mb: 1, children: ["Packs : ", selected.label] }), _jsx(HStack, { spacing: 2, children: price.map((pack, idx) => (_jsx(Button, { size: "xs", variant: "outline", borderColor: idx === selectedIndex ? theme.colors.primary[400] : theme.colors.primary[200], bg: idx === selectedIndex ? theme.colors.primary[50] : theme.colors.background[50], color: accentTextOnCanvas(theme.colors.primary, idx === selectedIndex ? theme.colors.primary[50] : theme.colors.background[50]), borderRadius: "lg", fontWeight: "medium", _hover: {
|
|
17
|
-
bg: theme.colors.primary[100],
|
|
18
|
-
}, _active: {
|
|
19
|
-
bg: theme.colors.primary[100],
|
|
20
|
-
}, onClick: () => setSelectedIndex(idx), children: pack.label }, pack.var_id))) })] })] }));
|
|
21
|
-
};
|
|
22
|
-
export default ProductDtlPrice;
|