pixelize-design-library 2.4.2-beta.55 → 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 +64 -0
- package/COMPONENT-GOTCHAS.md +50 -22
- package/DESIGN-GUIDE.md +19 -2
- 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/DatePickerProps.d.ts +1 -1
- 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/Input/PhoneNumberInputProps.d.ts +1 -1
- 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/MultiSelect/MultiSelectProps.d.ts +1 -1
- 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/PinInput/PinInputProps.d.ts +1 -1
- 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/Search/SearchProps.d.ts +1 -1
- package/dist/Components/SearchSelect/SearchSelectProps.d.ts +1 -1
- 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/Select/SelectProps.d.ts +1 -1
- package/dist/Components/SelectSearch/SelectSearchProps.d.ts +1 -1
- package/dist/Components/SelectV2/SelectV2Props.d.ts +1 -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/primitives/controlSizes.js +1 -1
- 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/tokens/primitives/controlSizes.js +1 -1
- 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,71 @@
|
|
|
1
|
+
const YOUTUBE = [
|
|
2
|
+
/youtube\.com\/watch\?[^#]*v=([A-Za-z0-9_-]{6,})/i,
|
|
3
|
+
/youtube\.com\/(?:embed|shorts|live)\/([A-Za-z0-9_-]{6,})/i,
|
|
4
|
+
/youtu\.be\/([A-Za-z0-9_-]{6,})/i,
|
|
5
|
+
];
|
|
6
|
+
const VIMEO = [/vimeo\.com\/(?:video\/)?(\d+)/i];
|
|
7
|
+
const firstMatch = (patterns, url) => {
|
|
8
|
+
for (const pattern of patterns) {
|
|
9
|
+
const found = pattern.exec(url);
|
|
10
|
+
if (found)
|
|
11
|
+
return found[1];
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
};
|
|
15
|
+
/** Only whitelisted ids reach an iframe `src`, so a product feed can never inject an arbitrary frame URL. */
|
|
16
|
+
export const parseEmbed = (url) => {
|
|
17
|
+
const youtube = firstMatch(YOUTUBE, url);
|
|
18
|
+
if (youtube) {
|
|
19
|
+
return {
|
|
20
|
+
provider: "youtube",
|
|
21
|
+
id: youtube,
|
|
22
|
+
src: `https://www.youtube.com/embed/${youtube}?rel=0&autoplay=1`,
|
|
23
|
+
poster: `https://img.youtube.com/vi/${youtube}/hqdefault.jpg`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const vimeo = firstMatch(VIMEO, url);
|
|
27
|
+
if (vimeo)
|
|
28
|
+
return { provider: "vimeo", id: vimeo, src: `https://player.vimeo.com/video/${vimeo}?autoplay=1` };
|
|
29
|
+
return undefined;
|
|
30
|
+
};
|
|
31
|
+
export const frameKind = (media) => {
|
|
32
|
+
if (media.type !== "video")
|
|
33
|
+
return "image";
|
|
34
|
+
return parseEmbed(media.src) ? "embed" : "video";
|
|
35
|
+
};
|
|
36
|
+
/** Still image to show for a frame before it plays, if the data offers one. */
|
|
37
|
+
export const framePoster = (media) => {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
if (media.type !== "video")
|
|
40
|
+
return media.src;
|
|
41
|
+
return (_a = media.poster) !== null && _a !== void 0 ? _a : (_b = parseEmbed(media.src)) === null || _b === void 0 ? void 0 : _b.poster;
|
|
42
|
+
};
|
|
43
|
+
export const frameThumb = (media) => { var _a; return (_a = media.thumb) !== null && _a !== void 0 ? _a : (media.type === "video" ? framePoster(media) : media.src); };
|
|
44
|
+
/** `activeMediaIds` order wins; unknown ids are dropped; an empty result falls back to every frame. */
|
|
45
|
+
export const resolveFrames = (media, activeMediaIds) => {
|
|
46
|
+
if (!activeMediaIds)
|
|
47
|
+
return media;
|
|
48
|
+
const byId = new Map(media.map((item) => [item.id, item]));
|
|
49
|
+
const picked = activeMediaIds.flatMap((id) => {
|
|
50
|
+
const found = byId.get(id);
|
|
51
|
+
return found ? [found] : [];
|
|
52
|
+
});
|
|
53
|
+
return picked.length > 0 ? picked : media;
|
|
54
|
+
};
|
|
55
|
+
export const clampIndex = (index, count) => count <= 0 ? 0 : Math.min(Math.max(Math.trunc(index) || 0, 0), count - 1);
|
|
56
|
+
/** Where a navigation key lands, or undefined when the key is not navigation. */
|
|
57
|
+
export const indexForKey = (key, index, count) => {
|
|
58
|
+
if (key === "ArrowLeft")
|
|
59
|
+
return clampIndex(index - 1, count);
|
|
60
|
+
if (key === "ArrowRight")
|
|
61
|
+
return clampIndex(index + 1, count);
|
|
62
|
+
if (key === "Home")
|
|
63
|
+
return 0;
|
|
64
|
+
if (key === "End")
|
|
65
|
+
return clampIndex(count - 1, count);
|
|
66
|
+
return undefined;
|
|
67
|
+
};
|
|
68
|
+
const OWN_KEYS = "video, iframe, input, textarea, select, [contenteditable='true']";
|
|
69
|
+
/** Arrow keys belong to a focused video, iframe or field, never to the carousel. */
|
|
70
|
+
export const keyBelongsToTarget = (target) => target instanceof Element && target.closest(OWN_KEYS) !== null;
|
|
71
|
+
export const frameSignature = (frames) => frames.map((frame) => frame.id).join("|");
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { keyframes } from "@emotion/react";
|
|
2
|
+
import { MOTION_EASE } from "../../Theme/tokens/primitives/motion.js";
|
|
3
|
+
/** Frame change: one slide per gesture, `transform` only. */
|
|
4
|
+
export const SLIDE_MS = 320;
|
|
5
|
+
/** Colour-linked frame set swap and the lightbox frame change. */
|
|
6
|
+
export const CROSSFADE_MS = 160;
|
|
7
|
+
const fade = keyframes `from { opacity: 0; } to { opacity: 1; }`;
|
|
8
|
+
export const fadeIn = (ms = CROSSFADE_MS) => `${fade} ${ms}ms ${MOTION_EASE} both`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
const supported = () => typeof window !== "undefined" && typeof window.matchMedia === "function";
|
|
3
|
+
/** `matches` for a media query, or `fallback` where matchMedia does not exist (SSR, jsdom). */
|
|
4
|
+
export const useMatchMedia = (query, fallback) => {
|
|
5
|
+
const [matches, setMatches] = useState(() => (supported() ? window.matchMedia(query).matches : fallback));
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!supported())
|
|
8
|
+
return undefined;
|
|
9
|
+
const list = window.matchMedia(query);
|
|
10
|
+
const onChange = () => setMatches(list.matches);
|
|
11
|
+
onChange();
|
|
12
|
+
list.addEventListener("change", onChange);
|
|
13
|
+
return () => list.removeEventListener("change", onChange);
|
|
14
|
+
}, [query]);
|
|
15
|
+
return matches;
|
|
16
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
3
|
+
import { Box, Flex, Text, VisuallyHidden } from "@chakra-ui/react";
|
|
4
|
+
import { Check, ChevronDown, Tag } from "lucide-react";
|
|
5
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
|
+
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
7
|
+
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
8
|
+
import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
|
|
9
|
+
const COPIED_MS = 1600;
|
|
10
|
+
const DEFAULT_LABELS = {
|
|
11
|
+
summary: (count, best) => `Offers (${count}) · Best: ${best}`,
|
|
12
|
+
summaryCount: (count) => `Offers (${count})`,
|
|
13
|
+
copy: "Copy",
|
|
14
|
+
copied: "Copied",
|
|
15
|
+
copyCode: (code) => `Copy code ${code}`,
|
|
16
|
+
copiedMessage: (code) => `Code ${code} copied`,
|
|
17
|
+
};
|
|
18
|
+
const writeToClipboard = (code) => {
|
|
19
|
+
var _a;
|
|
20
|
+
try {
|
|
21
|
+
const pending = (_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(code);
|
|
22
|
+
pending === null || pending === void 0 ? void 0 : pending.catch(() => undefined);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/** One collapsed tonal row ("Offers (3) · Best: ...") that opens into the full list with copy-code buttons; renders nothing for no offers. */
|
|
29
|
+
const OffersList = ({ offers, bestOfferId, isOpen, defaultOpen = false, onOpenChange, onCopy, labels, "data-testid": testId, }) => {
|
|
30
|
+
var _a;
|
|
31
|
+
const { colors } = useCustomTheme();
|
|
32
|
+
const panelId = useId();
|
|
33
|
+
const [innerOpen, setInnerOpen] = useState(defaultOpen);
|
|
34
|
+
const [copiedId, setCopiedId] = useState(null);
|
|
35
|
+
const [message, setMessage] = useState("");
|
|
36
|
+
const timer = useRef();
|
|
37
|
+
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
38
|
+
const open = isOpen !== null && isOpen !== void 0 ? isOpen : innerOpen;
|
|
39
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
40
|
+
if (offers.length === 0)
|
|
41
|
+
return null;
|
|
42
|
+
const best = (_a = offers.find((offer) => offer.id === bestOfferId)) !== null && _a !== void 0 ? _a : offers[0];
|
|
43
|
+
const summary = offers.length === 1
|
|
44
|
+
? `${best.title} · ${best.detail}`
|
|
45
|
+
: best.title
|
|
46
|
+
? copy.summary(offers.length, best.title)
|
|
47
|
+
: copy.summaryCount(offers.length);
|
|
48
|
+
const toggle = () => {
|
|
49
|
+
const next = !open;
|
|
50
|
+
if (isOpen === undefined)
|
|
51
|
+
setInnerOpen(next);
|
|
52
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(next);
|
|
53
|
+
};
|
|
54
|
+
const copyCode = (offer, code) => {
|
|
55
|
+
writeToClipboard(code);
|
|
56
|
+
setCopiedId(offer.id);
|
|
57
|
+
setMessage(copy.copiedMessage(code));
|
|
58
|
+
clearTimeout(timer.current);
|
|
59
|
+
timer.current = setTimeout(() => {
|
|
60
|
+
setCopiedId(null);
|
|
61
|
+
setMessage("");
|
|
62
|
+
}, COPIED_MS);
|
|
63
|
+
onCopy === null || onCopy === void 0 ? void 0 : onCopy(offer);
|
|
64
|
+
};
|
|
65
|
+
return (_jsxs(Box, { bg: colors.background[100], borderRadius: "xl", overflow: "hidden", "data-testid": testId, children: [_jsxs(Flex, { as: "button", type: "button", w: "100%", minH: "3rem", px: 4, py: 3, align: "center", gap: 3, textAlign: "left", borderRadius: "xl", color: colors.header[900], "aria-expanded": open, "aria-controls": panelId, onClick: toggle, transition: transitionFor(["background-color"]), _hover: { bg: colors.background[200] }, sx: { ...focusVisibleStyles(colors), ...reducedMotionSx() }, children: [_jsx(Box, { as: "span", "aria-hidden": true, display: "inline-flex", flexShrink: 0, color: colors.accentText, children: _jsx(Tag, { size: 18 }) }), _jsx(Text, { as: "span", flex: "1", minW: 0, fontSize: "sm", fontWeight: 600, noOfLines: open ? undefined : 1, children: summary }), _jsx(Box, { as: "span", "aria-hidden": true, display: "inline-flex", flexShrink: 0, color: colors.textMuted, transform: open ? "rotate(180deg)" : "rotate(0deg)", transition: transitionFor(["transform"]), sx: reducedMotionSx(), children: _jsx(ChevronDown, { size: 18 }) })] }), _jsx(Box, { id: panelId, hidden: !open, children: _jsx(Box, { as: "ul", listStyleType: "none", m: 0, px: 4, pb: 2, children: offers.map((offer) => {
|
|
66
|
+
const copied = copiedId === offer.id;
|
|
67
|
+
const { code } = offer;
|
|
68
|
+
return (_jsxs(Flex, { as: "li", position: "relative", align: "center", justify: "space-between", gap: 3, py: 3, sx: {
|
|
69
|
+
"&:not(:first-of-type)::before": {
|
|
70
|
+
content: '""',
|
|
71
|
+
position: "absolute",
|
|
72
|
+
top: 0,
|
|
73
|
+
left: 0,
|
|
74
|
+
right: 0,
|
|
75
|
+
height: "1px",
|
|
76
|
+
background: colors.background[200],
|
|
77
|
+
},
|
|
78
|
+
}, children: [_jsxs(Box, { minW: 0, children: [_jsx(Text, { fontSize: "sm", fontWeight: 600, color: colors.header[900], children: offer.title }), _jsx(Text, { mt: 0.5, fontSize: "sm", lineHeight: 1.45, color: colors.textMuted, children: offer.detail })] }), code ? (_jsxs(Flex, { align: "center", gap: 1, flexShrink: 0, children: [_jsx(Text, { as: "span", px: 2.5, py: 1, borderRadius: "md", bg: colors.background[200], color: colors.header[900], fontSize: "xs", fontWeight: 700, letterSpacing: "0.06em", sx: { fontVariantNumeric: "tabular-nums" }, children: code }), _jsxs(Flex, { as: "button", type: "button", align: "center", gap: 1.5, minH: "2.75rem", px: 3, borderRadius: "lg", fontSize: "sm", fontWeight: 600, color: colors.accentText, "aria-label": copied ? undefined : copy.copyCode(code), onClick: () => copyCode(offer, code), transition: transitionFor(["background-color"]), _hover: { bg: colors.background[200] }, sx: { ...focusVisibleStyles(colors), ...reducedMotionSx() }, children: [copied ? _jsx(Check, { size: 16, "aria-hidden": true }) : null, _jsx("span", { children: copied ? copy.copied : copy.copy })] })] })) : null] }, offer.id));
|
|
79
|
+
}) }) }), _jsx(VisuallyHidden, { "aria-live": "polite", children: message })] }));
|
|
80
|
+
};
|
|
81
|
+
export default OffersList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Box, Text } from "@chakra-ui/react";
|
|
4
|
+
import { Check } from "lucide-react";
|
|
5
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
|
+
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
7
|
+
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
8
|
+
import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
|
|
9
|
+
import { optionInk } from "./optionInk.js";
|
|
10
|
+
const CHIP_HEIGHT = { md: "2.75rem", lg: "3.25rem" };
|
|
11
|
+
const PACK_HEIGHT = { md: "3.5rem", lg: "4rem" };
|
|
12
|
+
const DOT = { md: "1.75rem", lg: "2rem" };
|
|
13
|
+
const TILE = { md: { w: "4rem", h: "5rem" }, lg: { w: "4.5rem", h: "5.625rem" } };
|
|
14
|
+
const DIM_OPACITY = 0.5;
|
|
15
|
+
const band = (color, half) => `linear-gradient(to top right, transparent calc(50% - ${half}), ${color} calc(50% - ${half}), ${color} calc(50% + ${half}), transparent calc(50% + ${half}))`;
|
|
16
|
+
const strikeImage = (ink, halo) => `${band(ink, "0.5px")}, ${band(halo, "1.5px")}`;
|
|
17
|
+
const strikeLayer = (image) => ({
|
|
18
|
+
position: "absolute",
|
|
19
|
+
inset: 0,
|
|
20
|
+
borderRadius: "inherit",
|
|
21
|
+
pointerEvents: "none",
|
|
22
|
+
backgroundImage: image,
|
|
23
|
+
});
|
|
24
|
+
const CheckGrow = ({ selected }) => (_jsx(Box, { as: "span", "aria-hidden": true, display: "inline-flex", alignItems: "center", flexShrink: 0, overflow: "hidden", w: selected ? "1.125rem" : 0, opacity: selected ? 1 : 0, transition: transitionFor(["width", "opacity"], "base"), sx: reducedMotionSx(), children: _jsx(Check, { size: 14, strokeWidth: 2.5 }) }));
|
|
25
|
+
const errorRing = (colors) => `inset 0 0 0 1px ${colors.semanticText.error}`;
|
|
26
|
+
/** The one selectable option control: text chip, colour swatch, image tile or pack. Parent group supplies the radiogroup. */
|
|
27
|
+
const OptionChip = forwardRef(function OptionChip({ label, selected = false, disabled = false, unavailable = false, invalid = false, variant = "chip", swatch, image, hint, showLabel = false, size = "md", fullWidth = false, onSelect, onFocus, tabIndex, "data-testid": testId, }, ref) {
|
|
28
|
+
const { colors } = useCustomTheme();
|
|
29
|
+
const { rest, selected: picked } = optionInk(colors);
|
|
30
|
+
const tone = selected ? picked : rest;
|
|
31
|
+
const dimmed = unavailable || disabled;
|
|
32
|
+
const accessibleName = [label, hint, unavailable ? "unavailable" : null].filter(Boolean).join(", ");
|
|
33
|
+
const strikeBackground = strikeImage(colors.text[800], colors.background[50]);
|
|
34
|
+
const base = {
|
|
35
|
+
ref,
|
|
36
|
+
as: "button",
|
|
37
|
+
type: "button",
|
|
38
|
+
role: "radio",
|
|
39
|
+
"aria-checked": selected,
|
|
40
|
+
"aria-disabled": unavailable || undefined,
|
|
41
|
+
"aria-label": accessibleName,
|
|
42
|
+
"data-testid": testId,
|
|
43
|
+
disabled,
|
|
44
|
+
tabIndex,
|
|
45
|
+
onClick: () => onSelect === null || onSelect === void 0 ? void 0 : onSelect(),
|
|
46
|
+
onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
|
|
47
|
+
position: "relative",
|
|
48
|
+
flexShrink: 0,
|
|
49
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
50
|
+
opacity: dimmed ? DIM_OPACITY : 1,
|
|
51
|
+
w: fullWidth ? "100%" : undefined,
|
|
52
|
+
transition: transitionFor(["background-color", "color", "box-shadow", "border-color", "transform"]),
|
|
53
|
+
_active: dimmed ? undefined : { transform: "scale(0.97)" },
|
|
54
|
+
};
|
|
55
|
+
const motion = {
|
|
56
|
+
...focusVisibleStyles(colors),
|
|
57
|
+
...reducedMotionSx({ "&:active": { transform: "none" } }),
|
|
58
|
+
};
|
|
59
|
+
if (variant === "swatch") {
|
|
60
|
+
const dot = DOT[size];
|
|
61
|
+
return (_jsxs(Box, { ...base, display: "inline-flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "0.25rem", minW: CHIP_HEIGHT[size], minH: CHIP_HEIGHT[size], borderRadius: "xl", bg: "transparent", color: colors.text[800], title: showLabel ? undefined : label, sx: {
|
|
62
|
+
...motion,
|
|
63
|
+
"&:hover:not(:disabled) [data-ring]:not([data-selected])": { borderColor: colors.boxborder[500] },
|
|
64
|
+
}, children: [_jsx(Box, { as: "span", "data-ring": true, "data-selected": selected ? "" : undefined, display: "inline-flex", p: "0.125rem", borderWidth: "2px", borderStyle: "solid", borderRadius: "full", borderColor: selected ? colors.header[900] : invalid ? colors.semanticText.error : "transparent", transition: transitionFor(["border-color"]), sx: reducedMotionSx(), children: _jsx(Box, { as: "span", position: "relative", display: "block", boxSize: dot, borderRadius: "full", backgroundColor: swatch !== null && swatch !== void 0 ? swatch : colors.background[200], boxShadow: `inset 0 0 0 1px ${colors.boxborder[200]}`, sx: unavailable ? { "&::after": { content: '""', ...strikeLayer(strikeBackground) } } : undefined }) }), showLabel ? (_jsx(Text, { as: "span", fontSize: "xs", fontWeight: selected ? 600 : 500, color: selected ? colors.header[900] : rest.ink, lineHeight: "short", children: label })) : null] }));
|
|
65
|
+
}
|
|
66
|
+
if (variant === "image-tile") {
|
|
67
|
+
const tile = TILE[size];
|
|
68
|
+
return (_jsxs(Box, { ...base, display: "inline-flex", flexDirection: "column", alignItems: "center", gap: "0.375rem", bg: "transparent", color: rest.ink, w: fullWidth ? "100%" : undefined, maxW: `calc(${tile.w} + 0.5rem)`, sx: motion, children: [_jsx(Box, { as: "span", display: "block", p: "0.125rem", borderWidth: "2px", borderStyle: "solid", borderRadius: "calc(0.75rem + 4px)", borderColor: selected ? colors.header[900] : invalid ? colors.semanticText.error : "transparent", transition: transitionFor(["border-color"]), sx: reducedMotionSx(), children: _jsxs(Box, { as: "span", position: "relative", display: "block", w: tile.w, h: tile.h, borderRadius: "xl", overflow: "hidden", backgroundColor: swatch !== null && swatch !== void 0 ? swatch : colors.background[100], sx: unavailable ? { "&::after": { content: '""', ...strikeLayer(strikeBackground) } } : undefined, children: [image ? _jsx(Box, { as: "img", src: image, alt: "", loading: "lazy", w: "100%", h: "100%", objectFit: "cover", display: "block" }) : null, _jsx(Box, { as: "span", "aria-hidden": true, position: "absolute", top: "0.25rem", right: "0.25rem", display: "inline-flex", alignItems: "center", justifyContent: "center", boxSize: "1.125rem", borderRadius: "full", bg: picked.fill, color: picked.ink, opacity: selected ? 1 : 0, transform: selected ? "scale(1)" : "scale(0.6)", transition: transitionFor(["opacity", "transform"], "base"), sx: reducedMotionSx({ transform: "none" }), children: _jsx(Check, { size: 12, strokeWidth: 3 }) })] }) }), _jsx(Text, { as: "span", maxW: "100%", fontSize: "xs", fontWeight: selected ? 600 : 500, lineHeight: "short", textAlign: "center", noOfLines: 2, wordBreak: "break-word", children: label }), hint ? (_jsx(Text, { as: "span", fontSize: "xs", lineHeight: "short", color: rest.hint, noOfLines: 1, children: hint })) : null] }));
|
|
69
|
+
}
|
|
70
|
+
const isPack = variant === "pack";
|
|
71
|
+
const surface = {
|
|
72
|
+
display: "inline-flex",
|
|
73
|
+
flexDirection: "column",
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
justifyContent: "center",
|
|
76
|
+
minW: isPack ? "5.75rem" : "3.5rem",
|
|
77
|
+
h: isPack ? PACK_HEIGHT[size] : CHIP_HEIGHT[size],
|
|
78
|
+
px: isPack ? 3 : 4,
|
|
79
|
+
borderRadius: "xl",
|
|
80
|
+
bg: tone.fill,
|
|
81
|
+
color: tone.ink,
|
|
82
|
+
fontSize: size === "lg" ? "md" : "sm",
|
|
83
|
+
fontWeight: 600,
|
|
84
|
+
lineHeight: "short",
|
|
85
|
+
whiteSpace: "nowrap",
|
|
86
|
+
boxShadow: invalid && !selected ? errorRing(colors) : "none",
|
|
87
|
+
};
|
|
88
|
+
const content = (_jsxs(Box, { as: "span", display: "inline-flex", alignItems: "center", children: [_jsx(CheckGrow, { selected: selected }), _jsx(Box, { as: "span", sx: { fontVariantNumeric: "tabular-nums" }, children: label })] }));
|
|
89
|
+
return (_jsxs(Box, { ...base, ...surface, sx: {
|
|
90
|
+
...motion,
|
|
91
|
+
"&:hover:not(:disabled):not([aria-checked=true])": unavailable ? undefined : { backgroundColor: tone.hoverFill },
|
|
92
|
+
...(unavailable ? { "&::after": { content: '""', ...strikeLayer(band("currentColor", "0.5px")) } } : {}),
|
|
93
|
+
}, children: [content, isPack && hint ? (_jsx(Text, { as: "span", mt: "0.125rem", fontSize: "0.6875rem", fontWeight: 500, color: tone.hint, sx: { fontVariantNumeric: "tabular-nums" }, children: hint })) : null, !isPack && hint ? (_jsx(Text, { as: "span", position: "absolute", top: "-0.375rem", right: "-0.25rem", px: "0.375rem", py: "0.0625rem", borderRadius: "full", bg: colors.surfaceRaised, color: colors.text[800], fontSize: "0.625rem", fontWeight: 600, lineHeight: "1rem", boxShadow: `0 0 0 1px ${colors.boxborder[200]}`, pointerEvents: "none", children: hint })) : null] }));
|
|
94
|
+
});
|
|
95
|
+
export default OptionChip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { mix } from "../../Theme/tokens/builders/color.js";
|
|
2
|
+
import { AA_NORMAL_TEXT, onFilled } from "../../Theme/tokens/builders/accentText.js";
|
|
3
|
+
import { liftToContrast } from "../../Theme/tokens/builders/outlineRung.js";
|
|
4
|
+
/** Resting and selected fills for an option; selection is the neutral ink fill, never the brand. */
|
|
5
|
+
export const optionInk = (colors) => {
|
|
6
|
+
const selectedFill = colors.header[900];
|
|
7
|
+
const selectedInk = onFilled(selectedFill, colors.white, colors.black);
|
|
8
|
+
const rest = {
|
|
9
|
+
fill: colors.background[300],
|
|
10
|
+
hoverFill: colors.background[400],
|
|
11
|
+
ink: colors.text[800],
|
|
12
|
+
hint: liftToContrast(colors.text[700], colors.background[400], AA_NORMAL_TEXT),
|
|
13
|
+
};
|
|
14
|
+
const selected = {
|
|
15
|
+
fill: selectedFill,
|
|
16
|
+
hoverFill: selectedFill,
|
|
17
|
+
ink: selectedInk,
|
|
18
|
+
hint: liftToContrast(mix(selectedInk, selectedFill, 0.2), selectedFill, AA_NORMAL_TEXT),
|
|
19
|
+
};
|
|
20
|
+
return { rest, selected };
|
|
21
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Flex, Text, VisuallyHidden } from "@chakra-ui/react";
|
|
3
|
+
import { Check } from "lucide-react";
|
|
4
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
5
|
+
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
6
|
+
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
7
|
+
import { onFilled } from "../../Theme/tokens/builders/accentText.js";
|
|
8
|
+
const DEFAULT_LABELS = { done: "Completed", current: "In progress", upcoming: "Upcoming" };
|
|
9
|
+
const MARKER = "1.5rem";
|
|
10
|
+
const RULE = "2px";
|
|
11
|
+
const Marker = ({ state, colors }) => {
|
|
12
|
+
const ink = colors.header[900];
|
|
13
|
+
const base = {
|
|
14
|
+
as: "span",
|
|
15
|
+
"aria-hidden": true,
|
|
16
|
+
display: "inline-flex",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
justifyContent: "center",
|
|
19
|
+
boxSize: MARKER,
|
|
20
|
+
flexShrink: 0,
|
|
21
|
+
borderRadius: "full",
|
|
22
|
+
transition: transitionFor(["background-color", "box-shadow"]),
|
|
23
|
+
sx: reducedMotionSx(),
|
|
24
|
+
};
|
|
25
|
+
if (state === "done") {
|
|
26
|
+
return (_jsx(Box, { ...base, bg: ink, color: onFilled(ink, colors.white, colors.black), children: _jsx(Check, { size: 14, strokeWidth: 3 }) }));
|
|
27
|
+
}
|
|
28
|
+
if (state === "current") {
|
|
29
|
+
return (_jsx(Box, { ...base, bg: "transparent", boxShadow: `inset 0 0 0 2px ${ink}`, children: _jsx(Box, { as: "span", boxSize: "0.5rem", borderRadius: "full", bg: ink }) }));
|
|
30
|
+
}
|
|
31
|
+
return _jsx(Box, { ...base, bg: "transparent", boxShadow: `inset 0 0 0 1.5px ${colors.textMuted}` });
|
|
32
|
+
};
|
|
33
|
+
const StepText = ({ step, copy, align, colors, }) => {
|
|
34
|
+
const active = step.state !== "upcoming";
|
|
35
|
+
return (_jsxs(Box, { textAlign: align, minW: 0, children: [_jsxs(Text, { as: "span", display: "block", fontSize: "sm", fontWeight: active ? 700 : 500, lineHeight: 1.4, color: active ? colors.header[900] : colors.textMuted, children: [_jsxs(VisuallyHidden, { children: [copy[step.state], ": "] }), step.label] }), step.date && (_jsx(Text, { as: "span", display: "block", fontSize: "xs", lineHeight: 1.4, color: colors.textMuted, sx: { fontVariantNumeric: "tabular-nums" }, children: step.date })), step.detail && (_jsx(Text, { as: "span", display: "block", fontSize: "xs", lineHeight: 1.4, color: colors.textMuted, children: step.detail }))] }));
|
|
36
|
+
};
|
|
37
|
+
/** Order tracking steps: filled check, ringed dot and hollow ring markers, each backed by spoken state text. */
|
|
38
|
+
const OrderStatusTimeline = ({ steps, orientation = "vertical", labels, "aria-label": ariaLabel = "Order status", "data-testid": testId, }) => {
|
|
39
|
+
const { colors } = useCustomTheme();
|
|
40
|
+
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
41
|
+
const filledRule = colors.header[900];
|
|
42
|
+
const idleRule = colors.boxborder[300];
|
|
43
|
+
if (orientation === "horizontal") {
|
|
44
|
+
return (_jsx(Box, { as: "ol", "aria-label": ariaLabel, display: "grid", gridTemplateColumns: `repeat(${steps.length}, minmax(0, 1fr))`, m: 0, p: 0, listStyleType: "none", "data-testid": testId, children: steps.map((step, i) => {
|
|
45
|
+
const before = i > 0 && steps[i - 1].state === "done";
|
|
46
|
+
const after = step.state === "done";
|
|
47
|
+
return (_jsxs(Flex, { as: "li", direction: "column", align: "center", gap: 2, px: 1, "aria-current": step.state === "current" ? "step" : undefined, "data-state": step.state, children: [_jsxs(Flex, { align: "center", w: "100%", children: [_jsx(Box, { flex: 1, h: RULE, bg: i === 0 ? "transparent" : before ? filledRule : idleRule }), _jsx(Marker, { state: step.state, colors: colors }), _jsx(Box, { flex: 1, h: RULE, bg: i === steps.length - 1 ? "transparent" : after ? filledRule : idleRule })] }), _jsx(StepText, { step: step, copy: copy, align: "center", colors: colors })] }, step.id));
|
|
48
|
+
}) }));
|
|
49
|
+
}
|
|
50
|
+
return (_jsx(Box, { as: "ol", "aria-label": ariaLabel, m: 0, p: 0, listStyleType: "none", "data-testid": testId, children: steps.map((step, i) => {
|
|
51
|
+
const last = i === steps.length - 1;
|
|
52
|
+
return (_jsxs(Flex, { as: "li", gap: 3, "aria-current": step.state === "current" ? "step" : undefined, "data-state": step.state, children: [_jsxs(Flex, { direction: "column", align: "center", flexShrink: 0, children: [_jsx(Marker, { state: step.state, colors: colors }), !last && _jsx(Box, { flex: 1, w: RULE, minH: "1.5rem", my: 1, bg: step.state === "done" ? filledRule : idleRule })] }), _jsx(Box, { pb: last ? 0 : 4, pt: "0.125rem", flex: 1, minW: 0, children: _jsx(StepText, { step: step, copy: copy, align: "left", colors: colors }) })] }, step.id));
|
|
53
|
+
}) }));
|
|
54
|
+
};
|
|
55
|
+
export default OrderStatusTimeline;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { Box, Flex, Text } from "@chakra-ui/react";
|
|
4
|
+
import { PartyPopper } from "lucide-react";
|
|
5
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
|
+
import { resolveSoftTone, toneScale } from "../../Theme/tokens/builders/tone.js";
|
|
7
|
+
import { formatPrice } from "../../Utils/price.js";
|
|
8
|
+
import ProgressBar from "../ProgressBar/ProgressBar.js";
|
|
9
|
+
import Skeletons from "../Skeletons/Skeletons.js";
|
|
10
|
+
const DEFAULT_LABELS = {
|
|
11
|
+
title: "Price details",
|
|
12
|
+
total: "Total",
|
|
13
|
+
free: "FREE",
|
|
14
|
+
savings: (amount) => `You save ${amount} on this order`,
|
|
15
|
+
addMore: (amount) => `Add ${amount} more for free delivery`,
|
|
16
|
+
unlocked: "You've unlocked free delivery",
|
|
17
|
+
progressLabel: "Progress to free delivery",
|
|
18
|
+
};
|
|
19
|
+
const MINUS = "−";
|
|
20
|
+
const tabular = { fontVariantNumeric: "tabular-nums" };
|
|
21
|
+
const SummarySkeleton = () => (_jsxs(Flex, { direction: "column", gap: 4, p: 5, borderRadius: "1.5rem", "aria-busy": "true", "data-testid": "order-summary-skeleton", children: [_jsx(Skeletons, { type: "skeleton", height: 4, width: "40%" }), [0, 1, 2].map((row) => (_jsxs(Flex, { justify: "space-between", children: [_jsx(Skeletons, { type: "skeleton", height: 3, width: "30%" }), _jsx(Skeletons, { type: "skeleton", height: 3, width: "20%" })] }, row))), _jsxs(Flex, { justify: "space-between", pt: 2, children: [_jsx(Skeletons, { type: "skeleton", height: 5, width: "25%" }), _jsx(Skeletons, { type: "skeleton", height: 5, width: "30%" })] })] }));
|
|
22
|
+
/** Tonal price panel: label/amount rows, a large tabular total, a calm savings banner and free-delivery progress. */
|
|
23
|
+
const OrderSummary = ({ lines, total, savings, taxNote, freeShippingProgress, hideTitle = false, isLoading = false, currency, locale, labels, "data-testid": testId, }) => {
|
|
24
|
+
const { colors } = useCustomTheme();
|
|
25
|
+
const headingId = useId();
|
|
26
|
+
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
27
|
+
const fmt = { currency, locale };
|
|
28
|
+
const panel = colors.background[100];
|
|
29
|
+
if (isLoading)
|
|
30
|
+
return _jsx(SummarySkeleton, {});
|
|
31
|
+
const inkFor = (line, isFree, isDeduction) => {
|
|
32
|
+
if (isFree || isDeduction || line.tone === "success")
|
|
33
|
+
return colors.semanticText.success;
|
|
34
|
+
return line.tone === "muted" ? colors.textMuted : colors.header[900];
|
|
35
|
+
};
|
|
36
|
+
const amountText = (line) => {
|
|
37
|
+
if (typeof line.amount === "string")
|
|
38
|
+
return { text: line.amount, isFree: false, isDeduction: false };
|
|
39
|
+
if (line.amount === 0 && line.freeWhenZero)
|
|
40
|
+
return { text: copy.free, isFree: true, isDeduction: false };
|
|
41
|
+
if (line.amount < 0)
|
|
42
|
+
return { text: `${MINUS}${formatPrice(Math.abs(line.amount), fmt)}`, isFree: false, isDeduction: true };
|
|
43
|
+
return { text: formatPrice(line.amount, fmt), isFree: false, isDeduction: false };
|
|
44
|
+
};
|
|
45
|
+
const success = resolveSoftTone(colors, toneScale(colors, "success"), panel);
|
|
46
|
+
const progress = freeShippingProgress;
|
|
47
|
+
const remaining = progress ? Math.max(0, progress.threshold - progress.current) : 0;
|
|
48
|
+
const unlocked = !!progress && remaining === 0;
|
|
49
|
+
const percent = progress && progress.threshold > 0 ? Math.min(100, Math.round((progress.current / progress.threshold) * 100)) : 0;
|
|
50
|
+
const progressText = unlocked ? copy.unlocked : copy.addMore(formatPrice(remaining, fmt));
|
|
51
|
+
return (_jsxs(Flex, { direction: "column", gap: 3, "data-testid": testId, children: [progress && (_jsxs(Flex, { direction: "column", gap: 2, px: 1, "data-testid": "order-summary-progress", children: [_jsx(Text, { as: "p", fontSize: "sm", fontWeight: 600, lineHeight: 1.4, color: unlocked ? colors.semanticText.success : colors.header[900], sx: tabular, children: progressText }), _jsx(ProgressBar, { size: "xs", value: percent, colorScheme: unlocked ? "green" : "primary", borderRadius: "full", "aria-label": copy.progressLabel, "aria-valuetext": progressText })] })), _jsxs(Box, { as: "section", "aria-labelledby": hideTitle ? undefined : headingId, "aria-label": hideTitle ? copy.title : undefined, bg: panel, borderRadius: "1.5rem", p: 5, children: [!hideTitle && (_jsx(Text, { as: "h2", id: headingId, fontSize: "md", fontWeight: 700, lineHeight: 1.4, color: colors.header[900], mb: 4, children: copy.title })), _jsx(Flex, { as: "dl", direction: "column", gap: 3, m: 0, children: lines.map((line) => {
|
|
52
|
+
var _a;
|
|
53
|
+
const { text, isFree, isDeduction } = amountText(line);
|
|
54
|
+
const ink = inkFor(line, isFree, isDeduction);
|
|
55
|
+
return (_jsxs(Flex, { justify: "space-between", align: "flex-start", gap: 4, children: [_jsxs(Box, { as: "dt", minW: 0, children: [_jsx(Text, { as: "span", fontSize: "sm", lineHeight: 1.45, color: line.tone === "muted" ? colors.textMuted : colors.text[800], children: line.label }), line.hint && (_jsx(Text, { as: "span", display: "block", fontSize: "xs", lineHeight: 1.4, color: colors.textMuted, children: line.hint }))] }), _jsx(Box, { as: "dd", m: 0, flexShrink: 0, textAlign: "right", fontSize: "sm", fontWeight: isFree || isDeduction ? 600 : 500, lineHeight: 1.45, color: ink, sx: tabular, children: text })] }, (_a = line.id) !== null && _a !== void 0 ? _a : line.label));
|
|
56
|
+
}) }), _jsxs(Flex, { justify: "space-between", align: "baseline", gap: 4, mt: 6, children: [_jsx(Text, { as: "span", fontSize: "md", fontWeight: 700, color: colors.header[900], children: copy.total }), _jsxs(Box, { textAlign: "right", children: [_jsx(Text, { as: "span", display: "block", fontSize: "1.5rem", fontWeight: 700, lineHeight: 1.2, letterSpacing: "-0.02em", color: colors.header[900], sx: tabular, "data-testid": "order-summary-total", children: formatPrice(total, fmt) }), taxNote && (_jsx(Text, { as: "span", display: "block", fontSize: "xs", lineHeight: 1.4, color: colors.textMuted, children: taxNote }))] })] }), savings !== undefined && savings > 0 && (_jsxs(Flex, { align: "center", gap: 2, mt: 4, px: 3, py: 2.5, borderRadius: "0.75rem", bg: success.bg, color: success.fg, "data-testid": "order-summary-savings", children: [_jsx(PartyPopper, { size: 16, "aria-hidden": true }), _jsx(Text, { as: "span", fontSize: "sm", fontWeight: 600, lineHeight: 1.4, sx: tabular, children: copy.savings(formatPrice(savings, fmt)) })] }))] })] }));
|
|
57
|
+
};
|
|
58
|
+
export default OrderSummary;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { Box, Flex, Text } from "@chakra-ui/react";
|
|
4
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
5
|
+
import { RadioIndicator, selectableSurface, useSelectable } from "../CheckoutKit/selectable.js";
|
|
6
|
+
import Tag from "../Tag/Tag.js";
|
|
7
|
+
/** Tonal payment-method row: icon well, title, subtitle, offer tag, and an area that opens when it is chosen. */
|
|
8
|
+
const PaymentOption = ({ value, title, subtitle, icon, offer, selected, onSelect, disabled = false, children, "data-testid": testId, }) => {
|
|
9
|
+
const { colors } = useCustomTheme();
|
|
10
|
+
const uid = useId();
|
|
11
|
+
const titleId = `${uid}-title`;
|
|
12
|
+
const subtitleId = `${uid}-subtitle`;
|
|
13
|
+
const regionId = `${uid}-region`;
|
|
14
|
+
const { isSelected, interactive, inGroup, ringed, props } = useSelectable({ value, selected, disabled, onSelect });
|
|
15
|
+
const selectable = inGroup || !!onSelect;
|
|
16
|
+
const expanded = isSelected && !!children;
|
|
17
|
+
return (_jsxs(Flex, { direction: "column", "data-testid": testId, "data-selected": isSelected || undefined, ...selectableSurface(colors, { selected: isSelected && selectable, disabled, interactive, ringed }), children: [_jsxs(Flex, { ...props, "data-radio": true, "aria-disabled": selectable && disabled ? true : undefined, "aria-labelledby": props.role ? titleId : undefined, "aria-describedby": props.role && subtitle ? subtitleId : undefined, "aria-controls": expanded && props.role === "radio" ? regionId : undefined, align: "center", gap: 3, p: 4, borderRadius: "1rem", cursor: interactive ? "pointer" : "default", outline: "none", children: [selectable && _jsx(RadioIndicator, { selected: isSelected }), icon && (_jsx(Flex, { as: "span", "aria-hidden": true, align: "center", justify: "center", boxSize: 10, flexShrink: 0, borderRadius: "0.75rem", bg: colors.background[50], color: colors.header[900], children: icon })), _jsxs(Box, { flex: 1, minW: 0, children: [_jsx(Text, { as: "span", id: titleId, display: "block", fontSize: "sm", fontWeight: 600, lineHeight: 1.4, color: colors.header[900], children: title }), subtitle && (_jsx(Text, { as: "span", id: subtitleId, display: "block", fontSize: "xs", lineHeight: 1.4, color: colors.textMuted, children: subtitle }))] }), offer && _jsx(Tag, { label: offer, size: "xs", tone: "success" })] }), expanded && (_jsx(Box, { id: regionId, role: "group", "aria-labelledby": titleId, px: 4, pb: 4, pl: selectable ? "3.25rem" : 4, children: children }))] }));
|
|
18
|
+
};
|
|
19
|
+
export default PaymentOption;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SelectableGroup } from "../CheckoutKit/selectable.js";
|
|
3
|
+
/** Radiogroup wrapper for `PaymentOption`s. */
|
|
4
|
+
const PaymentOptionGroup = (props) => _jsx(SelectableGroup, { ...props });
|
|
5
|
+
export default PaymentOptionGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|