pixelize-design-library 2.4.2-beta.56 → 2.4.2-beta.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -0
- package/COMPONENT-GOTCHAS.md +48 -20
- package/DESIGN-GUIDE.md +18 -1
- package/dist/Components/AddressCard/AddressCard.d.ts +4 -0
- package/dist/Components/AddressCard/AddressCard.js +25 -0
- package/dist/Components/AddressCard/AddressCardGroup.d.ts +4 -0
- package/dist/Components/AddressCard/AddressCardGroup.js +7 -0
- package/dist/Components/AddressCard/AddressCardProps.d.ts +43 -0
- package/dist/Components/AddressCard/AddressCardProps.js +2 -0
- package/dist/Components/BagBar/BagBar.d.ts +4 -0
- package/dist/Components/BagBar/BagBar.js +32 -0
- package/dist/Components/BagBar/BagBarProps.d.ts +30 -0
- package/dist/Components/BagBar/BagBarProps.js +2 -0
- package/dist/Components/CartItem/CartItem.d.ts +4 -0
- package/dist/Components/CartItem/CartItem.js +60 -0
- package/dist/Components/CartItem/CartItemProps.d.ts +64 -0
- package/dist/Components/CartItem/CartItemProps.js +2 -0
- package/dist/Components/CartItem/cartItemOptions.d.ts +3 -0
- package/dist/Components/CartItem/cartItemOptions.js +13 -0
- package/dist/Components/CheckoutKit/selectable.d.ts +58 -0
- package/dist/Components/CheckoutKit/selectable.js +120 -0
- package/dist/Components/Commerce/commerceTypes.d.ts +52 -0
- package/dist/Components/Commerce/commerceTypes.js +2 -0
- package/dist/Components/Commerce/commerceVariants.d.ts +13 -0
- package/dist/Components/Commerce/commerceVariants.js +51 -0
- package/dist/Components/Commerce/index.d.ts +2 -0
- package/dist/Components/Commerce/index.js +18 -0
- package/dist/Components/Commerce/useContainerWidth.d.ts +3 -0
- package/dist/Components/Commerce/useContainerWidth.js +25 -0
- package/dist/Components/CouponField/CouponField.d.ts +4 -0
- package/dist/Components/CouponField/CouponField.js +72 -0
- package/dist/Components/CouponField/CouponFieldProps.d.ts +49 -0
- package/dist/Components/CouponField/CouponFieldProps.js +2 -0
- package/dist/Components/DatePicker/PickerPortal.d.ts +11 -0
- package/dist/Components/DatePicker/PickerPortal.js +26 -0
- package/dist/Components/DatePicker/RangeDatePicker.d.ts +1 -1
- package/dist/Components/DatePicker/RangeDatePicker.js +67 -32
- package/dist/Components/DatePicker/SingleDatePicker.js +49 -13
- package/dist/Components/DatePicker/TimeOnlyPicker.js +39 -4
- package/dist/Components/DetailSections/DetailSections.d.ts +4 -0
- package/dist/Components/DetailSections/DetailSections.js +112 -0
- package/dist/Components/DetailSections/DetailSectionsProps.d.ts +58 -0
- package/dist/Components/DetailSections/DetailSectionsProps.js +2 -0
- package/dist/Components/MediaGallery/MediaFrame.d.ts +31 -0
- package/dist/Components/MediaGallery/MediaFrame.js +55 -0
- package/dist/Components/MediaGallery/MediaGallery.d.ts +4 -0
- package/dist/Components/MediaGallery/MediaGallery.js +206 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.d.ts +76 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.js +20 -0
- package/dist/Components/MediaGallery/MediaLightbox.d.ts +4 -0
- package/dist/Components/MediaGallery/MediaLightbox.js +116 -0
- package/dist/Components/MediaGallery/MediaLightboxProps.d.ts +40 -0
- package/dist/Components/MediaGallery/MediaLightboxProps.js +15 -0
- package/dist/Components/MediaGallery/MediaThumb.d.ts +18 -0
- package/dist/Components/MediaGallery/MediaThumb.js +25 -0
- package/dist/Components/MediaGallery/glass.d.ts +31 -0
- package/dist/Components/MediaGallery/glass.js +47 -0
- package/dist/Components/MediaGallery/mediaGalleryModel.d.ts +22 -0
- package/dist/Components/MediaGallery/mediaGalleryModel.js +83 -0
- package/dist/Components/MediaGallery/motion.d.ts +5 -0
- package/dist/Components/MediaGallery/motion.js +12 -0
- package/dist/Components/MediaGallery/useMatchMedia.d.ts +2 -0
- package/dist/Components/MediaGallery/useMatchMedia.js +20 -0
- package/dist/Components/OffersList/OffersList.d.ts +4 -0
- package/dist/Components/OffersList/OffersList.js +83 -0
- package/dist/Components/OffersList/OffersListProps.d.ts +34 -0
- package/dist/Components/OffersList/OffersListProps.js +2 -0
- package/dist/Components/OptionChip/OptionChip.d.ts +4 -0
- package/dist/Components/OptionChip/OptionChip.js +97 -0
- package/dist/Components/OptionChip/OptionChipProps.d.ts +33 -0
- package/dist/Components/OptionChip/OptionChipProps.js +2 -0
- package/dist/Components/OptionChip/optionInk.d.ts +12 -0
- package/dist/Components/OptionChip/optionInk.js +25 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.d.ts +4 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.js +57 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.d.ts +29 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +2 -0
- package/dist/Components/OrderSummary/OrderSummary.d.ts +4 -0
- package/dist/Components/OrderSummary/OrderSummary.js +63 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.d.ts +53 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.js +2 -0
- package/dist/Components/PaymentOption/PaymentOption.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOption.js +24 -0
- package/dist/Components/PaymentOption/PaymentOptionGroup.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOptionGroup.js +7 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.d.ts +32 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.js +2 -0
- package/dist/Components/PincodeChecker/PincodeChecker.d.ts +4 -0
- package/dist/Components/PincodeChecker/PincodeChecker.js +175 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.d.ts +57 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.js +2 -0
- package/dist/Components/PriceBlock/PriceBlock.d.ts +4 -0
- package/dist/Components/PriceBlock/PriceBlock.js +41 -0
- package/dist/Components/PriceBlock/PriceBlockProps.d.ts +39 -0
- package/dist/Components/PriceBlock/PriceBlockProps.js +2 -0
- package/dist/Components/ProductBadges/ProductBadges.d.ts +4 -0
- package/dist/Components/ProductBadges/ProductBadges.js +61 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.d.ts +18 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.js +2 -0
- package/dist/Components/ProductCard/ProductCard.d.ts +3 -2
- package/dist/Components/ProductCard/ProductCard.js +103 -52
- package/dist/Components/ProductCard/ProductCardAction.d.ts +17 -0
- package/dist/Components/ProductCard/ProductCardAction.js +65 -0
- package/dist/Components/ProductCard/ProductCardGrid.d.ts +4 -0
- package/dist/Components/ProductCard/ProductCardGrid.js +20 -0
- package/dist/Components/ProductCard/ProductCardMedia.d.ts +18 -0
- package/dist/Components/ProductCard/ProductCardMedia.js +35 -0
- package/dist/Components/ProductCard/ProductCardProps.d.ts +138 -56
- package/dist/Components/ProductCard/ProductCardSkeleton.d.ts +4 -0
- package/dist/Components/ProductCard/ProductCardSkeleton.js +17 -0
- package/dist/Components/ProductCard/ProductCardSwatches.d.ts +15 -0
- package/dist/Components/ProductCard/ProductCardSwatches.js +37 -0
- package/dist/Components/ProductCard/QuickAddSheet.d.ts +4 -0
- package/dist/Components/ProductCard/QuickAddSheet.js +109 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.d.ts +38 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.js +2 -0
- package/dist/Components/ProductCard/cardLabels.d.ts +2 -0
- package/dist/Components/ProductCard/cardLabels.js +16 -0
- package/dist/Components/ProductCard/cardMetrics.d.ts +27 -0
- package/dist/Components/ProductCard/cardMetrics.js +55 -0
- package/dist/Components/ProductCard/productCardFixtures.d.ts +7 -0
- package/dist/Components/ProductCard/productCardFixtures.js +61 -0
- package/dist/Components/ProductCard/productCardModel.d.ts +22 -0
- package/dist/Components/ProductCard/productCardModel.js +79 -0
- package/dist/Components/ProductCard/useMinWidth.d.ts +2 -0
- package/dist/Components/ProductCard/useMinWidth.js +20 -0
- package/dist/Components/ProductDetails/ProductDetails.d.ts +3 -2
- package/dist/Components/ProductDetails/ProductDetails.js +209 -33
- package/dist/Components/ProductDetails/ProductDetailsProps.d.ts +143 -41
- package/dist/Components/ProductDetails/productDetailsModel.d.ts +14 -0
- package/dist/Components/ProductDetails/productDetailsModel.js +45 -0
- package/dist/Components/ProductDetails/useInViewport.d.ts +3 -0
- package/dist/Components/ProductDetails/useInViewport.js +18 -0
- package/dist/Components/QuantityStepper/QuantityStepper.d.ts +4 -0
- package/dist/Components/QuantityStepper/QuantityStepper.js +59 -0
- package/dist/Components/QuantityStepper/QuantityStepperProps.d.ts +24 -0
- package/dist/Components/QuantityStepper/QuantityStepperProps.js +2 -0
- package/dist/Components/Rating/Rating.d.ts +4 -0
- package/dist/Components/Rating/Rating.js +81 -0
- package/dist/Components/Rating/RatingProps.d.ts +27 -0
- package/dist/Components/Rating/RatingProps.js +2 -0
- package/dist/Components/ReviewList/ReviewList.d.ts +4 -0
- package/dist/Components/ReviewList/ReviewList.js +94 -0
- package/dist/Components/ReviewList/ReviewListProps.d.ts +68 -0
- package/dist/Components/ReviewList/ReviewListProps.js +2 -0
- package/dist/Components/ReviewSummary/ReviewSummary.d.ts +4 -0
- package/dist/Components/ReviewSummary/ReviewSummary.js +47 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.d.ts +31 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.js +2 -0
- package/dist/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/Components/SegmentedControl/SegmentedControl.js +17 -5
- package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +6 -0
- package/dist/Components/SegmentedControl/segmentedInk.d.ts +2 -0
- package/dist/Components/SegmentedControl/segmentedInk.js +4 -1
- package/dist/Components/SegmentedControl/useSlidingPill.d.ts +2 -0
- package/dist/Components/SegmentedControl/useSlidingPill.js +6 -1
- package/dist/Components/SideBar/SecondaryBar.js +13 -8
- package/dist/Components/SideBar/SideBarProps.d.ts +3 -1
- package/dist/Components/SideBar/components/MenuItemBox.js +47 -10
- package/dist/Components/SideBar/components/MenuPopoverContent.js +4 -3
- package/dist/Components/SpecTable/SpecTable.d.ts +4 -0
- package/dist/Components/SpecTable/SpecTable.js +39 -0
- package/dist/Components/SpecTable/SpecTableProps.d.ts +25 -0
- package/dist/Components/SpecTable/SpecTableProps.js +2 -0
- package/dist/Components/Spinner/Spinner.d.ts +1 -1
- package/dist/Components/Spinner/Spinner.js +2 -2
- package/dist/Components/Spinner/SpinnerProps.d.ts +2 -0
- package/dist/Components/StageProgress/StepperStage.js +2 -1
- package/dist/Components/StatCard/StatCard.d.ts +1 -1
- package/dist/Components/StatCard/StatCard.js +2 -2
- package/dist/Components/StatCard/StatCardProps.d.ts +4 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.d.ts +3 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.js +85 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.d.ts +54 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.js +2 -0
- package/dist/Components/StockStatus/StockStatus.d.ts +4 -0
- package/dist/Components/StockStatus/StockStatus.js +31 -0
- package/dist/Components/StockStatus/StockStatusProps.d.ts +14 -0
- package/dist/Components/StockStatus/StockStatusProps.js +2 -0
- package/dist/Components/Table/Table.js +2 -1
- package/dist/Components/Table/TableProps.d.ts +5 -2
- package/dist/Components/Table/columnLabel.d.ts +6 -0
- package/dist/Components/Table/columnLabel.js +27 -0
- package/dist/Components/Table/components/TableBody.js +5 -1
- package/dist/Components/Table/components/TableHeader.js +3 -2
- package/dist/Components/Table/filters/ActiveFilters.js +2 -1
- package/dist/Components/Table/filters/TableFilters.js +2 -1
- package/dist/Components/Table/hooks/useTable.js +3 -2
- package/dist/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/Components/Table/settings/TableSettings.js +2 -1
- package/dist/Components/TrustBadges/TrustBadges.d.ts +4 -0
- package/dist/Components/TrustBadges/TrustBadges.js +24 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.d.ts +20 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.js +2 -0
- package/dist/Components/VariantSelector/VariantSelector.d.ts +4 -0
- package/dist/Components/VariantSelector/VariantSelector.js +123 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.d.ts +27 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.js +2 -0
- package/dist/Components/VariantSelector/variantSelection.d.ts +6 -0
- package/dist/Components/VariantSelector/variantSelection.js +25 -0
- package/dist/Components/WishlistToggle/WishlistToggle.d.ts +4 -0
- package/dist/Components/WishlistToggle/WishlistToggle.js +65 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.d.ts +19 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.js +2 -0
- package/dist/Theme/assertPalette.d.ts +1 -1
- package/dist/Theme/assertPalette.js +1 -1
- package/dist/Theme/tokens/brands/index.js +2 -0
- package/dist/Theme/tokens/brands/zinc/palette.dark.d.ts +1 -0
- package/dist/Theme/tokens/builders/buildDarkPalette.js +2 -0
- package/dist/Theme/tokens/builders/index.d.ts +1 -0
- package/dist/Theme/tokens/builders/index.js +1 -0
- package/dist/Theme/tokens/builders/rechartsTheme.d.ts +56 -0
- package/dist/Theme/tokens/builders/rechartsTheme.js +43 -0
- package/dist/Theme/tokens/builders/star.d.ts +3 -0
- package/dist/Theme/tokens/builders/star.js +8 -0
- package/dist/Theme/tokens/types.d.ts +3 -1
- package/dist/Theme/useChartTheme.d.ts +4 -0
- package/dist/Theme/useChartTheme.js +12 -0
- package/dist/Utils/price.d.ts +16 -0
- package/dist/Utils/price.js +34 -0
- package/dist/esm/Components/AddressCard/AddressCard.js +20 -0
- package/dist/esm/Components/AddressCard/AddressCardGroup.js +5 -0
- package/dist/esm/Components/AddressCard/AddressCardProps.js +1 -0
- package/dist/esm/Components/BagBar/BagBar.js +27 -0
- package/dist/esm/Components/BagBar/BagBarProps.js +1 -0
- package/dist/esm/Components/CartItem/CartItem.js +55 -0
- package/dist/esm/Components/CartItem/CartItemProps.js +1 -0
- package/dist/esm/Components/CartItem/cartItemOptions.js +9 -0
- package/dist/esm/Components/CheckoutKit/selectable.js +112 -0
- package/dist/esm/Components/Commerce/commerceTypes.js +1 -0
- package/dist/esm/Components/Commerce/commerceVariants.js +41 -0
- package/dist/esm/Components/Commerce/index.js +2 -0
- package/dist/esm/Components/Commerce/useContainerWidth.js +21 -0
- package/dist/esm/Components/CouponField/CouponField.js +67 -0
- package/dist/esm/Components/CouponField/CouponFieldProps.js +1 -0
- package/dist/esm/Components/DatePicker/PickerPortal.js +21 -0
- package/dist/esm/Components/DatePicker/RangeDatePicker.js +34 -32
- package/dist/esm/Components/DatePicker/SingleDatePicker.js +16 -13
- package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +6 -4
- package/dist/esm/Components/DetailSections/DetailSections.js +107 -0
- package/dist/esm/Components/DetailSections/DetailSectionsProps.js +1 -0
- package/dist/esm/Components/MediaGallery/MediaFrame.js +48 -0
- package/dist/esm/Components/MediaGallery/MediaGallery.js +201 -0
- package/dist/esm/Components/MediaGallery/MediaGalleryProps.js +17 -0
- package/dist/esm/Components/MediaGallery/MediaLightbox.js +78 -0
- package/dist/esm/Components/MediaGallery/MediaLightboxProps.js +12 -0
- package/dist/esm/Components/MediaGallery/MediaThumb.js +23 -0
- package/dist/esm/Components/MediaGallery/glass.js +42 -0
- package/dist/esm/Components/MediaGallery/mediaGalleryModel.js +71 -0
- package/dist/esm/Components/MediaGallery/motion.js +8 -0
- package/dist/esm/Components/MediaGallery/useMatchMedia.js +16 -0
- package/dist/esm/Components/OffersList/OffersList.js +81 -0
- package/dist/esm/Components/OffersList/OffersListProps.js +1 -0
- package/dist/esm/Components/OptionChip/OptionChip.js +95 -0
- package/dist/esm/Components/OptionChip/OptionChipProps.js +1 -0
- package/dist/esm/Components/OptionChip/optionInk.js +21 -0
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimeline.js +55 -0
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +1 -0
- package/dist/esm/Components/OrderSummary/OrderSummary.js +58 -0
- package/dist/esm/Components/OrderSummary/OrderSummaryProps.js +1 -0
- package/dist/esm/Components/PaymentOption/PaymentOption.js +19 -0
- package/dist/esm/Components/PaymentOption/PaymentOptionGroup.js +5 -0
- package/dist/esm/Components/PaymentOption/PaymentOptionProps.js +1 -0
- package/dist/esm/Components/PincodeChecker/PincodeChecker.js +170 -0
- package/dist/esm/Components/PincodeChecker/PincodeCheckerProps.js +1 -0
- package/dist/esm/Components/PriceBlock/PriceBlock.js +39 -0
- package/dist/esm/Components/PriceBlock/PriceBlockProps.js +1 -0
- package/dist/esm/Components/ProductBadges/ProductBadges.js +59 -0
- package/dist/esm/Components/ProductBadges/ProductBadgesProps.js +1 -0
- package/dist/esm/Components/ProductCard/ProductCard.js +105 -54
- package/dist/esm/Components/ProductCard/ProductCardAction.js +60 -0
- package/dist/esm/Components/ProductCard/ProductCardGrid.js +18 -0
- package/dist/esm/Components/ProductCard/ProductCardMedia.js +33 -0
- package/dist/esm/Components/ProductCard/ProductCardSkeleton.js +12 -0
- package/dist/esm/Components/ProductCard/ProductCardSwatches.js +35 -0
- package/dist/esm/Components/ProductCard/QuickAddSheet.js +71 -0
- package/dist/esm/Components/ProductCard/QuickAddSheetProps.js +1 -0
- package/dist/esm/Components/ProductCard/cardLabels.js +13 -0
- package/dist/esm/Components/ProductCard/cardMetrics.js +52 -0
- package/dist/esm/Components/ProductCard/productCardFixtures.js +58 -0
- package/dist/esm/Components/ProductCard/productCardModel.js +65 -0
- package/dist/esm/Components/ProductCard/useMinWidth.js +16 -0
- package/dist/esm/Components/ProductDetails/ProductDetails.js +210 -34
- package/dist/esm/Components/ProductDetails/productDetailsModel.js +35 -0
- package/dist/esm/Components/ProductDetails/useInViewport.js +14 -0
- package/dist/esm/Components/QuantityStepper/QuantityStepper.js +57 -0
- package/dist/esm/Components/QuantityStepper/QuantityStepperProps.js +1 -0
- package/dist/esm/Components/Rating/Rating.js +79 -0
- package/dist/esm/Components/Rating/RatingProps.js +1 -0
- package/dist/esm/Components/ReviewList/ReviewList.js +89 -0
- package/dist/esm/Components/ReviewList/ReviewListProps.js +1 -0
- package/dist/esm/Components/ReviewSummary/ReviewSummary.js +42 -0
- package/dist/esm/Components/ReviewSummary/ReviewSummaryProps.js +1 -0
- package/dist/esm/Components/SegmentedControl/SegmentedControl.js +19 -7
- package/dist/esm/Components/SegmentedControl/segmentedInk.js +2 -0
- package/dist/esm/Components/SegmentedControl/useSlidingPill.js +6 -1
- package/dist/esm/Components/SideBar/SecondaryBar.js +14 -9
- package/dist/esm/Components/SideBar/components/MenuItemBox.js +14 -10
- package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +4 -3
- package/dist/esm/Components/SpecTable/SpecTable.js +34 -0
- package/dist/esm/Components/SpecTable/SpecTableProps.js +1 -0
- package/dist/esm/Components/Spinner/Spinner.js +2 -2
- package/dist/esm/Components/StageProgress/StepperStage.js +2 -1
- package/dist/esm/Components/StatCard/StatCard.js +2 -2
- package/dist/esm/Components/StickyBuyBar/StickyBuyBar.js +80 -0
- package/dist/esm/Components/StickyBuyBar/StickyBuyBarProps.js +1 -0
- package/dist/esm/Components/StockStatus/StockStatus.js +29 -0
- package/dist/esm/Components/StockStatus/StockStatusProps.js +1 -0
- package/dist/esm/Components/Table/Table.js +2 -1
- package/dist/esm/Components/Table/columnLabel.js +21 -0
- package/dist/esm/Components/Table/components/TableBody.js +5 -1
- package/dist/esm/Components/Table/components/TableHeader.js +3 -2
- package/dist/esm/Components/Table/filters/ActiveFilters.js +2 -1
- package/dist/esm/Components/Table/filters/TableFilters.js +2 -1
- package/dist/esm/Components/Table/hooks/useTable.js +3 -2
- package/dist/esm/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/esm/Components/Table/settings/TableSettings.js +2 -1
- package/dist/esm/Components/TrustBadges/TrustBadges.js +22 -0
- package/dist/esm/Components/TrustBadges/TrustBadgesProps.js +1 -0
- package/dist/esm/Components/VariantSelector/VariantSelector.js +118 -0
- package/dist/esm/Components/VariantSelector/VariantSelectorProps.js +1 -0
- package/dist/esm/Components/VariantSelector/variantSelection.js +19 -0
- package/dist/esm/Components/WishlistToggle/WishlistToggle.js +63 -0
- package/dist/esm/Components/WishlistToggle/WishlistToggleProps.js +1 -0
- package/dist/esm/Theme/assertPalette.js +1 -1
- package/dist/esm/Theme/tokens/brands/index.js +2 -0
- package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +2 -0
- package/dist/esm/Theme/tokens/builders/index.js +1 -0
- package/dist/esm/Theme/tokens/builders/rechartsTheme.js +37 -0
- package/dist/esm/Theme/tokens/builders/star.js +4 -0
- package/dist/esm/Theme/useChartTheme.js +8 -0
- package/dist/esm/Utils/price.js +27 -0
- package/dist/esm/index.js +36 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +86 -4
- package/package.json +1 -1
- package/dist/Components/ProductCard/ProductLabel.d.ts +0 -7
- package/dist/Components/ProductCard/ProductLabel.js +0 -20
- package/dist/Components/ProductCard/ProductPrice.d.ts +0 -10
- package/dist/Components/ProductCard/ProductPrice.js +0 -126
- package/dist/Components/ProductCard/ProductReview.d.ts +0 -8
- package/dist/Components/ProductCard/ProductReview.js +0 -30
- package/dist/Components/ProductCard/ProductTags.d.ts +0 -8
- package/dist/Components/ProductCard/ProductTags.js +0 -53
- package/dist/Components/ProductDetails/ProductDtlPrice.d.ts +0 -7
- package/dist/Components/ProductDetails/ProductDtlPrice.js +0 -24
- package/dist/Components/ProductDetails/ProductImageSlider.d.ts +0 -13
- package/dist/Components/ProductDetails/ProductImageSlider.js +0 -240
- package/dist/esm/Components/ProductCard/ProductLabel.js +0 -18
- package/dist/esm/Components/ProductCard/ProductPrice.js +0 -121
- package/dist/esm/Components/ProductCard/ProductReview.js +0 -28
- package/dist/esm/Components/ProductCard/ProductTags.js +0 -48
- package/dist/esm/Components/ProductDetails/ProductDtlPrice.js +0 -22
- package/dist/esm/Components/ProductDetails/ProductImageSlider.js +0 -204
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Flex, Grid } from "@chakra-ui/react";
|
|
3
|
+
import { keyframes } from "@emotion/react";
|
|
4
|
+
import { Check } from "lucide-react";
|
|
5
|
+
import Button from "../Button/Button.js";
|
|
6
|
+
import PriceBlock from "../PriceBlock/PriceBlock.js";
|
|
7
|
+
import QuantityStepper from "../QuantityStepper/QuantityStepper.js";
|
|
8
|
+
import { glassStyles } from "../MediaGallery/glass.js";
|
|
9
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
10
|
+
import { MOTION_EASE, transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
11
|
+
import zIndices from "../../Theme/tokens/primitives/zIndices.js";
|
|
12
|
+
import { reducedMotionSx, usePrefersReducedMotion } from "../../Theme/chakra/motion.js";
|
|
13
|
+
const DEFAULT_LABELS = {
|
|
14
|
+
region: "Buy",
|
|
15
|
+
add: "Add to bag",
|
|
16
|
+
selectOption: "Select an option",
|
|
17
|
+
notify: "Notify me",
|
|
18
|
+
added: "Added",
|
|
19
|
+
goToBag: "Go to bag",
|
|
20
|
+
buyNow: "Buy now",
|
|
21
|
+
adding: "Adding to bag",
|
|
22
|
+
};
|
|
23
|
+
const SLIDE_MS = 240;
|
|
24
|
+
const BAR_HEIGHT = "3.25rem";
|
|
25
|
+
const SLOT_MIN_WIDTH = "9.5rem";
|
|
26
|
+
const RISE = "6px";
|
|
27
|
+
const NO_BLUR_SUPPORT = "@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)))";
|
|
28
|
+
const SAFE_BOTTOM = "calc(0.75rem + env(safe-area-inset-bottom, 0px))";
|
|
29
|
+
const pop = keyframes `0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); }`;
|
|
30
|
+
const STACK_ORDER = ["add", "select-option", "notify", "added", "go-to-bag"];
|
|
31
|
+
const StickyBuyBar = ({ price, mrp, mode = "add", visible = true, position = "sticky", isLoading = false, quantity, onQuantityChange, maxQuantity, onAddToBag, onSelectOption, onNotify, onGoToBag, onBuyNow, itemLabel, currency, locale, labels, "data-testid": testId, }) => {
|
|
32
|
+
const { colors } = useCustomTheme();
|
|
33
|
+
const reduced = usePrefersReducedMotion();
|
|
34
|
+
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
35
|
+
const glass = glassStyles(colors);
|
|
36
|
+
const stepping = mode === "stepper";
|
|
37
|
+
const active = stepping ? null : mode;
|
|
38
|
+
const text = {
|
|
39
|
+
add: copy.add,
|
|
40
|
+
"select-option": copy.selectOption,
|
|
41
|
+
notify: copy.notify,
|
|
42
|
+
added: copy.added,
|
|
43
|
+
"go-to-bag": copy.goToBag,
|
|
44
|
+
};
|
|
45
|
+
const handlers = {
|
|
46
|
+
add: onAddToBag,
|
|
47
|
+
"select-option": onSelectOption,
|
|
48
|
+
notify: onNotify,
|
|
49
|
+
added: undefined,
|
|
50
|
+
"go-to-bag": onGoToBag,
|
|
51
|
+
};
|
|
52
|
+
const tonal = mode === "notify";
|
|
53
|
+
const inert = mode === "added" || isLoading;
|
|
54
|
+
// NOTE: Button's prop type is a closed Pick, so aria-busy / aria-disabled ride in on a spread.
|
|
55
|
+
const aria = {
|
|
56
|
+
"aria-busy": isLoading ? "true" : undefined,
|
|
57
|
+
"aria-disabled": inert ? "true" : undefined,
|
|
58
|
+
"aria-label": isLoading ? copy.adding : undefined,
|
|
59
|
+
};
|
|
60
|
+
const layer = (on) => ({
|
|
61
|
+
gridArea: "1 / 1",
|
|
62
|
+
opacity: on ? 1 : 0,
|
|
63
|
+
visibility: on ? "visible" : "hidden",
|
|
64
|
+
transition: reduced ? "none" : `${transitionFor(["opacity"])}, visibility 0s linear ${on ? 0 : 150}ms`,
|
|
65
|
+
});
|
|
66
|
+
const label = (key) => {
|
|
67
|
+
const on = key === active;
|
|
68
|
+
return (_jsxs(Flex, { as: "span", "aria-hidden": on ? undefined : true, gridArea: "1 / 1", align: "center", justify: "center", gap: 1.5, opacity: on ? 1 : 0, transform: on || reduced ? "none" : `translateY(${RISE})`, transition: transitionFor(["opacity", "transform"]), sx: reducedMotionSx(), children: [key === "added" && (_jsx(Box, { as: "span", display: "inline-flex", animation: on && !reduced ? `${pop} 280ms ${MOTION_EASE} both` : undefined, sx: reducedMotionSx(), children: _jsx(Check, { size: 18, "aria-hidden": true }) })), text[key]] }, key));
|
|
69
|
+
};
|
|
70
|
+
return (_jsx(Box, { as: "section", role: "region", "aria-label": copy.region, "aria-hidden": visible ? undefined : true, position: position === "sticky" ? "sticky" : "relative", bottom: position === "sticky" ? 0 : undefined, zIndex: zIndices.sticky, px: 4, pt: 3, pb: SAFE_BOTTOM, transform: visible ? "translateY(0)" : "translateY(100%)", visibility: visible ? "visible" : "hidden", transition: reduced ? "none" : `transform ${SLIDE_MS}ms ${MOTION_EASE}, visibility 0s linear ${visible ? 0 : SLIDE_MS}ms`, "data-testid": testId, ...glass, sx: { ...glass.sx, [NO_BLUR_SUPPORT]: { backgroundColor: colors.surfaceRaised }, ...reducedMotionSx() }, children: _jsxs(Flex, { align: "center", gap: 3, children: [_jsx(Box, { flex: 1, minW: 0, children: _jsx(PriceBlock, { size: "sm", price: price, mrp: mrp, currency: currency, locale: locale }) }), mode === "add" && onBuyNow && (_jsx(Button, { variant: "outline", size: "lg", h: BAR_HEIGHT, onClick: onBuyNow, label: copy.buyNow })), _jsxs(Grid, { minW: SLOT_MIN_WIDTH, justifyItems: "stretch", alignItems: "center", children: [_jsx(Box, { ...layer(!stepping), "aria-hidden": stepping ? true : undefined, children: _jsx(Button, { ...aria, variant: tonal ? "ghost" : "solid", size: "lg", w: "100%", h: BAR_HEIGHT, onClick: () => {
|
|
71
|
+
var _a;
|
|
72
|
+
if (!inert)
|
|
73
|
+
(_a = handlers[mode]) === null || _a === void 0 ? void 0 : _a.call(handlers);
|
|
74
|
+
}, sx: {
|
|
75
|
+
...(tonal ? { bg: colors.background[100], color: colors.header[900], _hover: { bg: colors.background[200] } } : {}),
|
|
76
|
+
...(inert ? { cursor: isLoading ? "progress" : "default", pointerEvents: isLoading ? "auto" : "none" } : {}),
|
|
77
|
+
display: "grid",
|
|
78
|
+
}, children: STACK_ORDER.map(label) }) }), _jsx(Flex, { ...layer(stepping), "aria-hidden": stepping ? undefined : true, justify: "center", align: "center", h: BAR_HEIGHT, children: _jsx(QuantityStepper, { value: quantity, onValueChange: onQuantityChange, max: maxQuantity, itemLabel: itemLabel, size: "md" }) })] })] }) }));
|
|
79
|
+
};
|
|
80
|
+
export default StickyBuyBar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Flex, Text } from "@chakra-ui/react";
|
|
3
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
4
|
+
const TEXT_SIZE = { sm: "xs", md: "sm" };
|
|
5
|
+
const DOT_PX = { sm: 6, md: 8 };
|
|
6
|
+
const defaultMessage = (status, count) => {
|
|
7
|
+
switch (status) {
|
|
8
|
+
case "in-stock":
|
|
9
|
+
return "In stock";
|
|
10
|
+
case "low-stock":
|
|
11
|
+
return count !== undefined ? `Only ${count} left` : "Low stock";
|
|
12
|
+
case "out-of-stock":
|
|
13
|
+
return "Out of stock";
|
|
14
|
+
case "backorder":
|
|
15
|
+
return "Available on backorder";
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/** Availability dot + label for a `StockState`; colour comes from `semanticText`, meaning from the words. */
|
|
19
|
+
const StockStatus = ({ status, count, message, size = "md", "data-testid": testId }) => {
|
|
20
|
+
const { colors } = useCustomTheme();
|
|
21
|
+
const ink = {
|
|
22
|
+
"in-stock": colors.semanticText.success,
|
|
23
|
+
"low-stock": colors.semanticText.warning,
|
|
24
|
+
"out-of-stock": colors.textMuted,
|
|
25
|
+
backorder: colors.semanticText.info,
|
|
26
|
+
};
|
|
27
|
+
return (_jsxs(Flex, { as: "span", display: "inline-flex", align: "center", gap: 1.5, "data-status": status, "data-testid": testId, color: ink[status], children: [_jsx(Box, { as: "span", "aria-hidden": true, boxSize: `${DOT_PX[size]}px`, flexShrink: 0, borderRadius: "full", bg: "currentColor" }), _jsx(Text, { as: "span", fontSize: TEXT_SIZE[size], fontWeight: 600, lineHeight: 1.4, children: message !== null && message !== void 0 ? message : defaultMessage(status, count) })] }));
|
|
28
|
+
};
|
|
29
|
+
export default StockStatus;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -19,6 +19,7 @@ import { DENSITY_ROWS, EMPTY_STATE_HEIGHT, GROUP_HEADER_HEIGHT, MAX_TABLE_HEIGHT
|
|
|
19
19
|
import { scrollbarStyles, SCROLLBAR_WIDTH } from "../../Theme/tokens/builders/scrollbar.js";
|
|
20
20
|
import { scrollShadowStyles } from "../../Theme/tokens/builders/scrollShadow.js";
|
|
21
21
|
import useTable from "./hooks/useTable.js";
|
|
22
|
+
import { toSavedColumns } from "./columnLabel.js";
|
|
22
23
|
import { searchAndSortData, SortMultiColumnData, groupRows, buildTablePalette, pickTableColor } from "../../Utils/table.js";
|
|
23
24
|
import { useGetPreferences, useSavePreferences, } from "../../Hooks/usePreferences.js";
|
|
24
25
|
import TableSettings from "./settings/TableSettings.js";
|
|
@@ -165,7 +166,7 @@ export default function Table({ data, columns, onSelection, isLoading, isCheckbo
|
|
|
165
166
|
}, [tablePreferences === null || tablePreferences === void 0 ? void 0 : tablePreferences.groupBy]);
|
|
166
167
|
const handleDensityChange = (d) => {
|
|
167
168
|
setDensityState(d);
|
|
168
|
-
savePreferences === null || savePreferences === void 0 ? void 0 : savePreferences({ ...tablePreferences, columns: columnsList, groupBy: groupByState !== null && groupByState !== void 0 ? groupByState : null, density: d });
|
|
169
|
+
savePreferences === null || savePreferences === void 0 ? void 0 : savePreferences({ ...tablePreferences, columns: toSavedColumns(columnsList), groupBy: groupByState !== null && groupByState !== void 0 ? groupByState : null, density: d });
|
|
169
170
|
};
|
|
170
171
|
// Settings "Save": persist columns + group (+ current density) in ONE write so
|
|
171
172
|
// they don't clobber each other, and apply them locally.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isValidElement } from "react";
|
|
2
|
+
export const isPrimitiveLabel = (label) => typeof label === "string" || typeof label === "number";
|
|
3
|
+
const textOf = (node) => {
|
|
4
|
+
if (isPrimitiveLabel(node))
|
|
5
|
+
return String(node);
|
|
6
|
+
if (Array.isArray(node))
|
|
7
|
+
return node.map(textOf).join("");
|
|
8
|
+
if (isValidElement(node))
|
|
9
|
+
return textOf(node.props.children);
|
|
10
|
+
return "";
|
|
11
|
+
};
|
|
12
|
+
/** Plain-text name of a column, for every place a node cannot go: aria-labels, settings, chips, saved preferences. */
|
|
13
|
+
export const columnLabelText = (column) => {
|
|
14
|
+
if (isPrimitiveLabel(column.label))
|
|
15
|
+
return String(column.label);
|
|
16
|
+
if (column.labelText)
|
|
17
|
+
return column.labelText;
|
|
18
|
+
return textOf(column.label).replace(/\s+/g, " ").trim() || String(column.id);
|
|
19
|
+
};
|
|
20
|
+
/** Columns as they may be POSTed: a node label is swapped for its text, since elements are not JSON. */
|
|
21
|
+
export const toSavedColumns = (columns) => columns.map((column) => isPrimitiveLabel(column.label) ? column : { ...column, label: columnLabelText(column) });
|
|
@@ -12,6 +12,7 @@ import { useTableVariant } from "../variants/TableVariantContext.js";
|
|
|
12
12
|
import { resolvePillInk } from "../variants/pillInk.js";
|
|
13
13
|
import EmptyState from "../../EmptyState/EmptyState.js";
|
|
14
14
|
import { DENSITY_ROWS, EMPTY_STATE_HEIGHT, GROUP_HEADER_HEIGHT } from "./rowMetrics.js";
|
|
15
|
+
import { columnLabelText, isPrimitiveLabel } from "../columnLabel.js";
|
|
15
16
|
import { transitionFor } from "../../../Theme/tokens/primitives/motion.js";
|
|
16
17
|
import { reducedMotionSx } from "../../../Theme/chakra/motion.js";
|
|
17
18
|
const getRowId = (row) => row.id;
|
|
@@ -80,7 +81,10 @@ const TableRow = React.memo(({ row, rowIndex, isChecked, isExpanded, isContent,
|
|
|
80
81
|
}, [onMeasure, isExpanded, hasContent, row]);
|
|
81
82
|
const handleCellClick = useCallback((header) => {
|
|
82
83
|
if (!header.node && onRowClick) {
|
|
83
|
-
onRowClick(row, {
|
|
84
|
+
onRowClick(row, {
|
|
85
|
+
label: isPrimitiveLabel(header.label) ? header.label : columnLabelText(header),
|
|
86
|
+
id: header.id,
|
|
87
|
+
});
|
|
84
88
|
}
|
|
85
89
|
}, [row, onRowClick]);
|
|
86
90
|
const variant = useTableVariant();
|
|
@@ -5,6 +5,7 @@ import { calculateLeftOffset } from "../../../Utils/table.js";
|
|
|
5
5
|
import { useCustomTheme } from "../../../Theme/useCustomTheme.js";
|
|
6
6
|
import { accentTextOnCanvas } from "../../../Theme/tokens/builders/accentText.js";
|
|
7
7
|
import TableFilters from "../filters/TableFilters.js";
|
|
8
|
+
import { columnLabelText } from "../columnLabel.js";
|
|
8
9
|
import { ChevronDown, ChevronsUpDown, ChevronUp } from "lucide-react";
|
|
9
10
|
import CheckBox from "../../Checkbox/Checkbox.js";
|
|
10
11
|
import { useTableVariant } from "../variants/TableVariantContext.js";
|
|
@@ -17,7 +18,7 @@ const TableHeader = ({ columns, isCheckbox, handleSort, headerRefs, columnWidths
|
|
|
17
18
|
return (_jsxs(Tr, { pr: 0, "aria-rowindex": 1, children: [isContent && _jsx(ContentSpacerCell, { noBorders: noBorders }), isCheckbox && (_jsx(SelectAllCell, { slotRef: slotRef, freezedTextColor: freezedTextColor, noBorders: noBorders, isSelecting: isSelecting, isLoading: isLoading, checked: checked, handleCheckbox: handleCheckbox })), columns.map((header, index) => {
|
|
18
19
|
if (header === null || header === void 0 ? void 0 : header.isHidden)
|
|
19
20
|
return null;
|
|
20
|
-
return (_jsx(ColumnHeader, { header: header, index: index, columnWidths: columnWidths, slotWidth: slotWidth, handleSort: handleSort, isCheckbox: isCheckbox, noBorders: noBorders, columnsSort: columnsSort, headerRefs: headerRefs, columnsSearch: columnsSearch, setColumnsSearch: setColumnsSearch, openFilterId: openFilterId, setOpenFilterId: setOpenFilterId }, header
|
|
21
|
+
return (_jsx(ColumnHeader, { header: header, index: index, columnWidths: columnWidths, slotWidth: slotWidth, handleSort: handleSort, isCheckbox: isCheckbox, noBorders: noBorders, columnsSort: columnsSort, headerRefs: headerRefs, columnsSearch: columnsSearch, setColumnsSearch: setColumnsSearch, openFilterId: openFilterId, setOpenFilterId: setOpenFilterId }, columnLabelText(header)));
|
|
21
22
|
}), isLink && _jsx(ViewSpacerCell, { noBorders: noBorders, isActionFreeze: isActionFreeze })] }));
|
|
22
23
|
};
|
|
23
24
|
export default memo(TableHeader);
|
|
@@ -91,7 +92,7 @@ const ColumnHeader = memo(({ header, index, columnWidths, slotWidth, isCheckbox,
|
|
|
91
92
|
!!columnsSearch[header.id];
|
|
92
93
|
return (_jsx(Th, { scope: "col", ref: (el) => (headerRefs.current[index] = el), "aria-sort": ariaSort, textAlign: align, textTransform: variant.header.textTransform, fontSize: variant.header.fontSize, fontWeight: variant.header.fontWeight, letterSpacing: variant.header.letterSpacing, position: isFrozen ? "sticky" : undefined, left: isFrozen ? `${leftOffset}px` : undefined, minWidth: 120, backgroundColor: variant.header.bg, maxWidth: 500, zIndex: isFrozen ? 2 : 1, py: 2, pr: align === "end" ? undefined : 0, overflow: "hidden", borderTop: "none", borderBottom: noBorders ? "none" : `0.063rem solid ${variant.header.ruleColor}`, borderRight: noBorders || !variant.header.showColumnRule
|
|
93
94
|
? "none"
|
|
94
|
-
: `0.063rem solid ${variant.header.ruleColor}`, className: `columns ${isFrozen ? "sticky-columns" : "scrollable-columns"}`, height: variant.header.height, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: _jsxs(Box, { display: "flex", color: variant.header.ink, lineHeight: "1.25rem", justifyContent: LABEL_JUSTIFY[align], flexDirection: align === "end" ? "row-reverse" : "row", gap: align === "end" ? 1 : undefined, alignItems: "center", position: "relative", children: [_jsx(Box, { textAlign: align, textOverflow: "ellipsis", whiteSpace: "nowrap", display: "inline-block", overflow: "hidden", children: header.label }), _jsxs(Box, { display: "inline-flex", alignItems: "center", opacity: showActions ? 1 : 0, transition: transitionFor(["opacity"], "base"), sx: reducedMotionSx(), _focusWithin: { opacity: 1 }, children: [header.isSort && (_jsx(SortingIcon, { label:
|
|
95
|
+
: `0.063rem solid ${variant.header.ruleColor}`, className: `columns ${isFrozen ? "sticky-columns" : "scrollable-columns"}`, height: variant.header.height, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: _jsxs(Box, { display: "flex", color: variant.header.ink, lineHeight: "1.25rem", justifyContent: LABEL_JUSTIFY[align], flexDirection: align === "end" ? "row-reverse" : "row", gap: align === "end" ? 1 : undefined, alignItems: "center", position: "relative", children: [_jsx(Box, { textAlign: align, textOverflow: "ellipsis", whiteSpace: "nowrap", display: "inline-block", overflow: "hidden", children: header.label }), _jsxs(Box, { display: "inline-flex", alignItems: "center", opacity: showActions ? 1 : 0, transition: transitionFor(["opacity"], "base"), sx: reducedMotionSx(), _focusWithin: { opacity: 1 }, children: [header.isSort && (_jsx(SortingIcon, { label: columnLabelText(header), sortState: (_b = isSorting === null || isSorting === void 0 ? void 0 : isSorting.direction) !== null && _b !== void 0 ? _b : "none", isVisible: isHovered || isSortActive, handleSortClick: () => {
|
|
95
96
|
let direction = "asc";
|
|
96
97
|
if ((isSorting === null || isSorting === void 0 ? void 0 : isSorting.direction) === "asc") {
|
|
97
98
|
direction = "desc";
|
|
@@ -7,6 +7,7 @@ import { accentTextOnCanvas } from "../../../Theme/tokens/builders/accentText.js
|
|
|
7
7
|
import { resolveSoftTone } from "../../../Theme/tokens/builders/tone.js";
|
|
8
8
|
import { scrollbarStyles } from "../../../Theme/tokens/builders/scrollbar.js";
|
|
9
9
|
import { focusVisibleStyles } from "../../../Theme/chakra/focusRing.styles.js";
|
|
10
|
+
import { columnLabelText } from "../columnLabel.js";
|
|
10
11
|
import VeritcalDivider from "../../Divider/Divider.js";
|
|
11
12
|
const ActiveFilters = React.memo(({ columns, columnsSearch, setColumnsSearch, }) => {
|
|
12
13
|
const theme = useCustomTheme();
|
|
@@ -14,7 +15,7 @@ const ActiveFilters = React.memo(({ columns, columnsSearch, setColumnsSearch, })
|
|
|
14
15
|
const columnLabelMap = useMemo(() => {
|
|
15
16
|
const map = new Map();
|
|
16
17
|
for (const col of columns) {
|
|
17
|
-
map.set(col.id, col
|
|
18
|
+
map.set(col.id, columnLabelText(col));
|
|
18
19
|
}
|
|
19
20
|
return map;
|
|
20
21
|
}, [columns]);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { Icon, IconButton, Input, InputGroup, InputLeftElement, Popover, PopoverBody, PopoverContent, PopoverTrigger, Portal, useTheme, } from "@chakra-ui/react";
|
|
4
|
+
import { columnLabelText } from "../columnLabel.js";
|
|
4
5
|
import { EllipsisVertical, Search } from "lucide-react";
|
|
5
6
|
const TableFilters = memo(({ header, setColumnsSearch, columnsSearch, onClose, isOpen, onOpen, }) => {
|
|
6
7
|
const theme = useTheme();
|
|
@@ -36,7 +37,7 @@ const TableFilters = memo(({ header, setColumnsSearch, columnsSearch, onClose, i
|
|
|
36
37
|
setRefreshDataOnOpen((prev) => !prev);
|
|
37
38
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
38
39
|
};
|
|
39
|
-
return (_jsxs(Popover, { isOpen: isOpen, onClose: onClose, onOpen: handleOpen, children: [_jsx(PopoverTrigger, { children: _jsx(IconButton, { "aria-label": `Filter ${header
|
|
40
|
+
return (_jsxs(Popover, { isOpen: isOpen, onClose: onClose, onOpen: handleOpen, children: [_jsx(PopoverTrigger, { children: _jsx(IconButton, { "aria-label": `Filter ${columnLabelText(header)}`, icon: _jsx(EllipsisVertical, { size: 17, color: theme.colors.primary[900] }), size: "xs", variant: "ghost", _hover: { bg: "none" } }) }), _jsx(Portal, { children: _jsx(PopoverContent, { width: "200px", bg: theme.colors.surfaceRaised, children: _jsx(PopoverBody, { p: 2, children: _jsxs(InputGroup, { flex: "1", size: "xs", children: [_jsx(InputLeftElement, { pointerEvents: "none", children: _jsx(Icon, { as: Search, color: theme.colors.textMuted, boxSize: 4 }) }), _jsx(Input, { autoFocus: true, placeholder: `Search ${columnLabelText(header)}...`, size: "xs", ref: searchRef, onChange: (e) => {
|
|
40
41
|
e.stopPropagation();
|
|
41
42
|
debouncedSearch(e.target.value);
|
|
42
43
|
}, onFocus: (e) => e.stopPropagation() })] }) }) }) })] }));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { searchAndSortData, SortMultiColumnData } from "../../../Utils/table.js";
|
|
3
|
+
import { isPrimitiveLabel, toSavedColumns } from "../columnLabel.js";
|
|
3
4
|
export const DEFAULT_PAGE_SIZE = 20;
|
|
4
5
|
const defaultPageSize = DEFAULT_PAGE_SIZE;
|
|
5
6
|
const mergeColumnWithPreference = (pref, originalCol) => {
|
|
@@ -10,7 +11,7 @@ const mergeColumnWithPreference = (pref, originalCol) => {
|
|
|
10
11
|
const next = { ...originalCol };
|
|
11
12
|
next.isHidden =
|
|
12
13
|
typeof pref.isHidden === "boolean" ? pref.isHidden : (_a = originalCol === null || originalCol === void 0 ? void 0 : originalCol.isHidden) !== null && _a !== void 0 ? _a : false;
|
|
13
|
-
if (
|
|
14
|
+
if (isPrimitiveLabel(pref.label) && isPrimitiveLabel(originalCol === null || originalCol === void 0 ? void 0 : originalCol.label)) {
|
|
14
15
|
next.label = pref.label;
|
|
15
16
|
}
|
|
16
17
|
return next;
|
|
@@ -217,7 +218,7 @@ const useTable = ({ data, isPagination, selections, onSelection, tablePreference
|
|
|
217
218
|
if (savePreferences) {
|
|
218
219
|
savePreferences({
|
|
219
220
|
...tablePreferences,
|
|
220
|
-
columns: columns,
|
|
221
|
+
columns: toSavedColumns(columns),
|
|
221
222
|
...extra,
|
|
222
223
|
});
|
|
223
224
|
}
|
|
@@ -6,6 +6,7 @@ import { useCustomTheme } from "../../../Theme/useCustomTheme.js";
|
|
|
6
6
|
import { scrollbarStyles } from "../../../Theme/tokens/builders/scrollbar.js";
|
|
7
7
|
import { accentTextOnCanvas } from "../../../Theme/tokens/builders/accentText.js";
|
|
8
8
|
import { listRowBackgrounds } from "../../../Theme/tokens/builders/rowStates.js";
|
|
9
|
+
import { columnLabelText } from "../columnLabel.js";
|
|
9
10
|
import { ChevronDown, ChevronUp, GripVertical } from "lucide-react";
|
|
10
11
|
import { transitionFor } from "../../../Theme/tokens/primitives/motion.js";
|
|
11
12
|
const ManageColumns = ({ columns, items, setItems, childInputMethodsRef, }) => {
|
|
@@ -61,7 +62,7 @@ const ManageColumns = ({ columns, items, setItems, childInputMethodsRef, }) => {
|
|
|
61
62
|
setItems(newItems);
|
|
62
63
|
setError(null);
|
|
63
64
|
};
|
|
64
|
-
const filteredItems = items.filter((item) => item
|
|
65
|
+
const filteredItems = items.filter((item) => columnLabelText(item).toLowerCase().includes(searchTerm.toLowerCase()));
|
|
65
66
|
const allChecked = items.every((item) => !item.isHidden);
|
|
66
67
|
const someChecked = items.some((item) => !item.isHidden) && !allChecked;
|
|
67
68
|
const handleSelectAll = () => {
|
|
@@ -87,9 +88,9 @@ const ManageColumns = ({ columns, items, setItems, childInputMethodsRef, }) => {
|
|
|
87
88
|
: "transparent", cursor: "grab", fontSize: "13px", px: 2, py: "3px", mb: "3px", transition: transitionFor(["background-color", "border-color"]), _hover: {
|
|
88
89
|
bg: rowBackgrounds.active,
|
|
89
90
|
borderColor: theme.colors.boxborder[200],
|
|
90
|
-
}, _active: { cursor: "grabbing" }, children: [_jsx(Box, { as: "span", "aria-hidden": "true", display: "inline-flex", cursor: "grab", mr: 1, _hover: { color: theme.colors.textMuted }, children: _jsx(GripVertical, { size: 14 }) }), _jsx(Checkbox, { isChecked: !item.isHidden, label:
|
|
91
|
+
}, _active: { cursor: "grabbing" }, children: [_jsx(Box, { as: "span", "aria-hidden": "true", display: "inline-flex", cursor: "grab", mr: 1, _hover: { color: theme.colors.textMuted }, children: _jsx(GripVertical, { size: 14 }) }), _jsx(Checkbox, { isChecked: !item.isHidden, label: columnLabelText(item), onChange: () => toggleCheckbox(item.id), size: "sm", labelSx: {
|
|
91
92
|
color: item.isHidden ? theme.colors.textMuted : theme.colors.text[700],
|
|
92
|
-
} }), _jsx(Text, { fontSize: "12px", color: theme.colors.textMuted, ml: 'auto', children: index + 1 }), _jsx(IconButton, { "aria-label": `Move ${item
|
|
93
|
+
} }), _jsx(Text, { fontSize: "12px", color: theme.colors.textMuted, ml: 'auto', children: index + 1 }), _jsx(IconButton, { "aria-label": `Move ${columnLabelText(item)} up`, icon: _jsx(ChevronUp, { size: 14 }), variant: "ghost", size: "xs", ml: 1, minW: "auto", h: "auto", p: 0, color: theme.colors.textMuted, isDisabled: realIndex <= 0, onClick: () => moveItem(item.id, -1) }), _jsx(IconButton, { "aria-label": `Move ${columnLabelText(item)} down`, icon: _jsx(ChevronDown, { size: 14 }), variant: "ghost", size: "xs", ml: 1, minW: "auto", h: "auto", p: 0, color: theme.colors.textMuted, isDisabled: realIndex === -1 || realIndex >= items.length - 1, onClick: () => moveItem(item.id, 1) })] }, item.id));
|
|
93
94
|
})) : (_jsx(Text, { color: theme.colors.textMuted, textAlign: "center", fontSize: "sm", py: 6, children: "No columns found" })) }), _jsxs(Text, { fontSize: "xs", color: theme.colors.textMuted, mt: 2, textAlign: "right", children: [visibleCount, " / ", items.length, " visible"] })] }));
|
|
94
95
|
};
|
|
95
96
|
export default ManageColumns;
|
|
@@ -6,6 +6,7 @@ import ManageColumns from "./ManageColumns.js";
|
|
|
6
6
|
import Button from "../../Button/Button.js";
|
|
7
7
|
import { useCustomTheme } from "../../../Theme/useCustomTheme.js";
|
|
8
8
|
import { scrollbarStyles } from "../../../Theme/tokens/builders/scrollbar.js";
|
|
9
|
+
import { columnLabelText } from "../columnLabel.js";
|
|
9
10
|
import { Settings, Check } from "lucide-react";
|
|
10
11
|
import ToolTip from "../../ToolTip/ToolTip.js";
|
|
11
12
|
import { listRowBackgrounds } from "../../../Theme/tokens/builders/rowStates.js";
|
|
@@ -67,7 +68,7 @@ const TableSettings = ({ columns, onSave, density = "normal", onDensityChange, g
|
|
|
67
68
|
// Only columns that declare a `columnType` are groupable.
|
|
68
69
|
...columns
|
|
69
70
|
.filter((c) => !!c.columnType && !c.isHidden)
|
|
70
|
-
.map((c) => ({ id: c.id, label:
|
|
71
|
+
.map((c) => ({ id: c.id, label: columnLabelText(c) }))]
|
|
71
72
|
.map((opt) => {
|
|
72
73
|
var _a;
|
|
73
74
|
const selected = selectedGroup === opt.id;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Flex, Text } from "@chakra-ui/react";
|
|
3
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
4
|
+
const DEFAULT_LABEL = "Why shop with us";
|
|
5
|
+
const LIST_STYLES = {
|
|
6
|
+
row: { display: "flex", flexWrap: "wrap" },
|
|
7
|
+
grid: { display: "grid", gridTemplateColumns: "repeat(2, minmax(0, 1fr))" },
|
|
8
|
+
stack: { display: "flex", flexDirection: "column" },
|
|
9
|
+
};
|
|
10
|
+
/** Reassurance items (returns, COD, authenticity, secure payments) on calm tonal tiles; the title always carries the meaning. */
|
|
11
|
+
const TrustBadges = ({ items, layout = "row", "aria-label": ariaLabel = DEFAULT_LABEL, "data-testid": testId }) => {
|
|
12
|
+
const { colors } = useCustomTheme();
|
|
13
|
+
if (items.length === 0)
|
|
14
|
+
return null;
|
|
15
|
+
const stacked = layout === "stack";
|
|
16
|
+
const tile = (item) => {
|
|
17
|
+
var _a;
|
|
18
|
+
return (_jsxs(Flex, { as: "li", align: stacked ? "center" : "flex-start", gap: 3, p: 3, minH: "2.75rem", borderRadius: "xl", bg: colors.background[100], flex: layout === "row" ? "1 1 9.5rem" : undefined, minW: 0, children: [_jsx(Flex, { as: "span", "aria-hidden": true, flexShrink: 0, align: "center", justify: "center", boxSize: "2.25rem", borderRadius: "full", bg: colors.background[50], color: colors.accentText, sx: { "& svg": { width: "1.125rem", height: "1.125rem" } }, children: item.icon }), _jsxs(Box, { minW: 0, children: [_jsx(Text, { fontSize: "sm", fontWeight: 600, lineHeight: 1.35, color: colors.header[900], children: item.title }), item.detail ? (_jsx(Text, { mt: 0.5, fontSize: "xs", lineHeight: 1.4, color: colors.textMuted, children: item.detail })) : null] })] }, (_a = item.id) !== null && _a !== void 0 ? _a : item.title));
|
|
19
|
+
};
|
|
20
|
+
return (_jsx(Box, { as: "ul", "aria-label": ariaLabel, "data-layout": layout, "data-testid": testId, listStyleType: "none", m: 0, p: 0, gap: 2, sx: LIST_STYLES[layout], children: items.map(tile) }));
|
|
21
|
+
};
|
|
22
|
+
export default TrustBadges;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useId, useRef, useState } from "react";
|
|
3
|
+
import { Box, Flex, Text } from "@chakra-ui/react";
|
|
4
|
+
import { CircleAlert, Ruler } from "lucide-react";
|
|
5
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
|
+
import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
|
|
7
|
+
import { scrollbarStyles } from "../../Theme/tokens/builders/scrollbar.js";
|
|
8
|
+
import OptionChip from "../OptionChip/OptionChip.js";
|
|
9
|
+
import { LOW_STOCK_THRESHOLD, findVariant, isOptionAvailable, remainingStock, } from "../Commerce/commerceVariants.js";
|
|
10
|
+
import { isSoldOutEverywhere, sameSelection, selectValue } from "./variantSelection.js";
|
|
11
|
+
const GAP = "0.5rem";
|
|
12
|
+
const GRID_MIN = {
|
|
13
|
+
chip: "4rem",
|
|
14
|
+
swatch: "3rem",
|
|
15
|
+
"image-tile": "4.75rem",
|
|
16
|
+
pack: "6.5rem",
|
|
17
|
+
};
|
|
18
|
+
const cellKey = (axisId, valueId) => `${axisId}\u0000${valueId}`;
|
|
19
|
+
/** Per-axis radiogroups whose availability is derived from `variants`; no vertical-specific vocabulary lives here. */
|
|
20
|
+
const VariantSelector = ({ axes, variants, value, defaultValue, onValueChange, error, showSelectedLabel = false, showLowStock = false, size = "md", layout = "wrap", onGuideClick, "data-testid": testId, }) => {
|
|
21
|
+
const { colors } = useCustomTheme();
|
|
22
|
+
const uid = useId();
|
|
23
|
+
const statusId = `${uid}-status`;
|
|
24
|
+
const cells = useRef(new Map());
|
|
25
|
+
const [inner, setInner] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : {});
|
|
26
|
+
const [focus, setFocus] = useState(null);
|
|
27
|
+
const selection = value !== null && value !== void 0 ? value : inner;
|
|
28
|
+
const commit = useCallback((next) => {
|
|
29
|
+
if (sameSelection(next, selection))
|
|
30
|
+
return;
|
|
31
|
+
if (value === undefined)
|
|
32
|
+
setInner(next);
|
|
33
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(next, findVariant(axes, variants, next));
|
|
34
|
+
}, [axes, variants, selection, value, onValueChange]);
|
|
35
|
+
const choose = (axisId, valueId) => {
|
|
36
|
+
if (isSoldOutEverywhere(variants, axisId, valueId))
|
|
37
|
+
return;
|
|
38
|
+
commit(selectValue(axes, variants, selection, axisId, valueId));
|
|
39
|
+
};
|
|
40
|
+
const lowStockHint = (axis, option) => {
|
|
41
|
+
if (!showLowStock)
|
|
42
|
+
return undefined;
|
|
43
|
+
const left = remainingStock(variants, selection, axis.id, option.id);
|
|
44
|
+
if (left === undefined || left <= 0 || left > LOW_STOCK_THRESHOLD)
|
|
45
|
+
return undefined;
|
|
46
|
+
return `${left} left`;
|
|
47
|
+
};
|
|
48
|
+
const hintFor = (axis, option) => {
|
|
49
|
+
const low = lowStockHint(axis, option);
|
|
50
|
+
if (!low)
|
|
51
|
+
return option.hint;
|
|
52
|
+
return axis.type === "pack" && option.hint ? `${option.hint} · ${low}` : low;
|
|
53
|
+
};
|
|
54
|
+
const onKeyDown = (axis) => (event) => {
|
|
55
|
+
var _a;
|
|
56
|
+
const index = axis.values.findIndex((option) => cells.current.get(cellKey(axis.id, option.id)) === document.activeElement);
|
|
57
|
+
if (index < 0)
|
|
58
|
+
return;
|
|
59
|
+
const last = axis.values.length - 1;
|
|
60
|
+
const target = event.key === "ArrowRight" || event.key === "ArrowDown"
|
|
61
|
+
? (index + 1) % axis.values.length
|
|
62
|
+
: event.key === "ArrowLeft" || event.key === "ArrowUp"
|
|
63
|
+
? (index - 1 + axis.values.length) % axis.values.length
|
|
64
|
+
: event.key === "Home"
|
|
65
|
+
? 0
|
|
66
|
+
: event.key === "End"
|
|
67
|
+
? last
|
|
68
|
+
: -1;
|
|
69
|
+
if (target < 0)
|
|
70
|
+
return;
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
const next = axis.values[target];
|
|
73
|
+
(_a = cells.current.get(cellKey(axis.id, next.id))) === null || _a === void 0 ? void 0 : _a.focus();
|
|
74
|
+
setFocus({ axisId: axis.id, valueId: next.id });
|
|
75
|
+
if (isOptionAvailable(variants, selection, axis.id, next.id))
|
|
76
|
+
choose(axis.id, next.id);
|
|
77
|
+
};
|
|
78
|
+
const containerStyles = (axis) => {
|
|
79
|
+
if (layout === "grid") {
|
|
80
|
+
return { display: "grid", gridTemplateColumns: `repeat(auto-fill, minmax(${GRID_MIN[axis.type]}, 1fr))`, gap: GAP };
|
|
81
|
+
}
|
|
82
|
+
if (layout === "scroll") {
|
|
83
|
+
return {
|
|
84
|
+
display: "flex",
|
|
85
|
+
flexWrap: "nowrap",
|
|
86
|
+
gap: GAP,
|
|
87
|
+
overflowX: "auto",
|
|
88
|
+
pt: "0.5rem",
|
|
89
|
+
mt: "-0.5rem",
|
|
90
|
+
pr: "0.5rem",
|
|
91
|
+
scrollSnapType: "x proximity",
|
|
92
|
+
sx: scrollbarStyles(colors, "hover"),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return { display: "flex", flexWrap: "wrap", gap: GAP, pt: "0.25rem" };
|
|
96
|
+
};
|
|
97
|
+
return (_jsxs(Flex, { direction: "column", gap: 5, "data-testid": testId, children: [axes.map((axis) => {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
const labelId = `${uid}-${axis.id}-label`;
|
|
100
|
+
const picked = axis.values.find((option) => option.id === selection[axis.id]);
|
|
101
|
+
const unpicked = selection[axis.id] === undefined;
|
|
102
|
+
const invalid = !!error && unpicked;
|
|
103
|
+
const available = axis.values.map((option) => isOptionAvailable(variants, selection, axis.id, option.id));
|
|
104
|
+
const firstAvailable = (_a = axis.values.find((_, i) => available[i])) !== null && _a !== void 0 ? _a : axis.values[0];
|
|
105
|
+
const stopId = (focus === null || focus === void 0 ? void 0 : focus.axisId) === axis.id ? focus.valueId : (_b = (picked !== null && picked !== void 0 ? picked : firstAvailable)) === null || _b === void 0 ? void 0 : _b.id;
|
|
106
|
+
const { guide } = axis;
|
|
107
|
+
return (_jsxs(Box, { children: [_jsxs(Flex, { align: "baseline", justify: "space-between", gap: 3, mb: 3, children: [_jsxs(Flex, { align: "baseline", gap: 2, minW: 0, children: [_jsx(Text, { as: "span", id: labelId, fontSize: "sm", fontWeight: 600, color: colors.header[900], children: axis.label }), showSelectedLabel && picked ? (_jsx(Text, { as: "span", fontSize: "sm", color: colors.textMuted, noOfLines: 1, children: picked.label })) : null] }), guide ? (_jsxs(Box, { as: "button", type: "button", display: "inline-flex", alignItems: "center", gap: 1, flexShrink: 0, fontSize: "sm", fontWeight: 600, color: colors.accentText, borderRadius: "md", onClick: () => {
|
|
108
|
+
guide.onClick();
|
|
109
|
+
onGuideClick === null || onGuideClick === void 0 ? void 0 : onGuideClick(axis.id);
|
|
110
|
+
}, sx: focusVisibleStyles(colors), children: [_jsx(Ruler, { size: 14, "aria-hidden": true }), guide.label] })) : null] }), _jsx(Box, { role: "radiogroup", "aria-labelledby": labelId, "aria-invalid": invalid || undefined, "aria-describedby": invalid ? statusId : undefined, onKeyDown: onKeyDown(axis), onBlur: (event) => {
|
|
111
|
+
if (!event.currentTarget.contains(event.relatedTarget))
|
|
112
|
+
setFocus(null);
|
|
113
|
+
}, ...containerStyles(axis), children: axis.values.map((option, i) => (_jsx(OptionChip, { ref: (node) => {
|
|
114
|
+
cells.current.set(cellKey(axis.id, option.id), node);
|
|
115
|
+
}, label: option.label, variant: axis.type, swatch: option.swatch, image: option.image, hint: hintFor(axis, option), showLabel: axis.type === "swatch" && layout === "grid", size: size, fullWidth: layout === "grid" && (axis.type === "chip" || axis.type === "pack"), selected: option.id === selection[axis.id], unavailable: !available[i], invalid: invalid, tabIndex: option.id === stopId ? 0 : -1, onFocus: () => setFocus({ axisId: axis.id, valueId: option.id }), onSelect: () => choose(axis.id, option.id) }, option.id))) })] }, axis.id));
|
|
116
|
+
}), _jsx(Box, { role: "status", id: statusId, "aria-live": "polite", mt: error ? -2 : 0, children: error ? (_jsxs(Flex, { align: "center", gap: 1.5, color: colors.semanticText.error, fontSize: "sm", fontWeight: 600, children: [_jsx(CircleAlert, { size: 14, "aria-hidden": true }), _jsx(Text, { as: "span", children: error })] })) : null })] }));
|
|
117
|
+
};
|
|
118
|
+
export default VariantSelector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isOptionAvailable } from "../Commerce/commerceVariants.js";
|
|
2
|
+
/** Picks `valueId` on `axisId`, then drops every other pick that no sellable variant can pair with it. */
|
|
3
|
+
export const selectValue = (axes, variants, selection, axisId, valueId) => {
|
|
4
|
+
const next = { ...selection, [axisId]: valueId };
|
|
5
|
+
for (const axis of axes) {
|
|
6
|
+
const pick = next[axis.id];
|
|
7
|
+
if (axis.id === axisId || pick === undefined)
|
|
8
|
+
continue;
|
|
9
|
+
if (!isOptionAvailable(variants, next, axis.id, pick))
|
|
10
|
+
delete next[axis.id];
|
|
11
|
+
}
|
|
12
|
+
return next;
|
|
13
|
+
};
|
|
14
|
+
/** Sold out under every combination, so picking it can never lead to a purchasable variant. */
|
|
15
|
+
export const isSoldOutEverywhere = (variants, axisId, valueId) => !isOptionAvailable(variants, {}, axisId, valueId);
|
|
16
|
+
export const sameSelection = (a, b) => {
|
|
17
|
+
const keys = new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
18
|
+
return [...keys].every((key) => a[key] === b[key]);
|
|
19
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Box } from "@chakra-ui/react";
|
|
4
|
+
import { keyframes } from "@emotion/react";
|
|
5
|
+
import { Heart } from "lucide-react";
|
|
6
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
7
|
+
import { MOTION_EASE, transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
8
|
+
import { BUTTON_SIZES } from "../../Theme/tokens/primitives/controlSizes.js";
|
|
9
|
+
import { reducedMotionSx, usePrefersReducedMotion } from "../../Theme/chakra/motion.js";
|
|
10
|
+
import { focusVisibleRing } from "../../Theme/chakra/focusRing.styles.js";
|
|
11
|
+
import { resolveFilledSurface } from "../../Theme/tokens/builders/filledSurface.js";
|
|
12
|
+
import { overlayScrim } from "../../Theme/tokens/builders/scrim.js";
|
|
13
|
+
const HIT_PX = { sm: 32, md: 44, lg: 48 };
|
|
14
|
+
const POP_MS = 320;
|
|
15
|
+
const pop = keyframes `
|
|
16
|
+
0% { transform: scale(1); }
|
|
17
|
+
40% { transform: scale(1.2); }
|
|
18
|
+
100% { transform: scale(1); }
|
|
19
|
+
`;
|
|
20
|
+
/** Heart toggle for saving a product: glass on media, tonal or bare elsewhere; pops once when saved. */
|
|
21
|
+
const WishlistToggle = ({ selected, defaultSelected = false, onSelectedChange, size = "md", variant = "soft", label, isDisabled = false, "data-testid": testId, }) => {
|
|
22
|
+
const { colors } = useCustomTheme();
|
|
23
|
+
const reduced = usePrefersReducedMotion();
|
|
24
|
+
const [inner, setInner] = useState(defaultSelected);
|
|
25
|
+
const [popKey, setPopKey] = useState(0);
|
|
26
|
+
const on = selected !== null && selected !== void 0 ? selected : inner;
|
|
27
|
+
const spec = BUTTON_SIZES[size];
|
|
28
|
+
const hit = HIT_PX[size];
|
|
29
|
+
const icon = spec.iconSize + 2;
|
|
30
|
+
const popping = on && popKey > 0 && !reduced;
|
|
31
|
+
const toggle = () => {
|
|
32
|
+
const next = !on;
|
|
33
|
+
if (selected === undefined)
|
|
34
|
+
setInner(next);
|
|
35
|
+
if (next)
|
|
36
|
+
setPopKey((k) => k + 1);
|
|
37
|
+
onSelectedChange === null || onSelectedChange === void 0 ? void 0 : onSelectedChange(next);
|
|
38
|
+
};
|
|
39
|
+
const saved = resolveFilledSurface(colors.semantic.error, colors);
|
|
40
|
+
const look = (() => {
|
|
41
|
+
if (variant === "glass") {
|
|
42
|
+
return on
|
|
43
|
+
? { bg: saved.fill, hoverBg: saved.hoverFill, color: saved.color }
|
|
44
|
+
: { bg: overlayScrim(colors), hoverBg: overlayScrim(colors), color: colors.white };
|
|
45
|
+
}
|
|
46
|
+
const ink = on ? colors.semanticText.error : variant === "soft" ? colors.header[900] : colors.textMuted;
|
|
47
|
+
return {
|
|
48
|
+
bg: variant === "soft" ? colors.background[100] : colors.transparent,
|
|
49
|
+
hoverBg: variant === "soft" ? colors.background[200] : colors.background[100],
|
|
50
|
+
color: ink,
|
|
51
|
+
};
|
|
52
|
+
})();
|
|
53
|
+
return (_jsx(Box, { as: "button", type: "button", "aria-pressed": on, "aria-label": label !== null && label !== void 0 ? label : (on ? "Remove from wishlist" : "Add to wishlist"), disabled: isDisabled, onClick: toggle, "data-testid": testId, "data-selected": on || undefined, display: "inline-flex", alignItems: "center", justifyContent: "center", boxSize: `${hit}px`, flexShrink: 0, borderRadius: "full", cursor: isDisabled ? "not-allowed" : "pointer", opacity: isDisabled ? 0.5 : 1, sx: {
|
|
54
|
+
outline: "none",
|
|
55
|
+
"&:focus-visible > [data-disc]": focusVisibleRing(colors),
|
|
56
|
+
"&:hover:not(:disabled) > [data-disc]": { backgroundColor: look.hoverBg },
|
|
57
|
+
...(reduced ? {} : { "&:active:not(:disabled) > [data-disc]": { transform: "scale(0.92)" } }),
|
|
58
|
+
}, children: _jsx(Box, { as: "span", "data-disc": true, display: "inline-flex", alignItems: "center", justifyContent: "center", boxSize: spec.height, borderRadius: "full", bg: look.bg, color: look.color, transition: transitionFor(["background-color", "color", "transform"]), sx: {
|
|
59
|
+
...(variant === "glass" ? { backdropFilter: "blur(8px)", WebkitBackdropFilter: "blur(8px)" } : {}),
|
|
60
|
+
...reducedMotionSx(),
|
|
61
|
+
}, children: _jsx(Box, { as: "span", display: "inline-flex", "data-pop": popping || undefined, animation: popping ? `${pop} ${POP_MS}ms ${MOTION_EASE}` : undefined, children: _jsx(Heart, { size: icon, "aria-hidden": true, fill: on ? "currentColor" : "none", strokeWidth: 2 }) }, popKey) }) }));
|
|
62
|
+
};
|
|
63
|
+
export default WishlistToggle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@ const REQUIRED_GROUPS = [
|
|
|
3
3
|
"semantic", "gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan",
|
|
4
4
|
"purple", "pink", "backgroundColor", "background", "text", "header", "placeholder",
|
|
5
5
|
"boxShadow", "focusRing", "sidebar", "boxborder", "border", "table", "disabled",
|
|
6
|
-
"accentText", "textMuted", "semanticText", "onPrimary", "onSemantic", "surfaceRaised",
|
|
6
|
+
"accentText", "textMuted", "semanticText", "onPrimary", "onSemantic", "surfaceRaised", "star",
|
|
7
7
|
];
|
|
8
8
|
export const allPaletteTokensListed = true;
|
|
9
9
|
const NESTED = [
|
|
@@ -25,6 +25,7 @@ import { withPlaceholderRung, withTableHoverRung } from "../builders/resolvedRun
|
|
|
25
25
|
import { buildFocusRing, withFocusRing } from "../builders/focusRing.js";
|
|
26
26
|
import { withSurfaceRungs } from "../builders/surfaceRungs.js";
|
|
27
27
|
import { buildSurfaceRaised, withSurfaceRaised } from "../builders/surfaceRaised.js";
|
|
28
|
+
import { buildStar } from "../builders/star.js";
|
|
28
29
|
/** Derived, never hand-written: a copied hex goes stale the moment a canvas moves. */
|
|
29
30
|
export const finalizeLightPalette = (source) => ({
|
|
30
31
|
...source,
|
|
@@ -36,6 +37,7 @@ export const finalizeLightPalette = (source) => ({
|
|
|
36
37
|
onSemantic: buildOnSemantic(source.semantic, source.white, source.black),
|
|
37
38
|
focusRing: buildFocusRing(source),
|
|
38
39
|
surfaceRaised: buildSurfaceRaised(source),
|
|
40
|
+
star: buildStar(source.backgroundColor.main),
|
|
39
41
|
});
|
|
40
42
|
export { lavender, meadow, radiant, skyline, slate, emerald, rosewood, storefront, zinc };
|
|
41
43
|
export { lavenderDark, meadowDark, radiantDark, skylineDark, slateDark, emeraldDark, rosewoodDark, storefrontDark, zincDark, };
|
|
@@ -6,6 +6,7 @@ import { buildMutedText } from "./mutedText.js";
|
|
|
6
6
|
import { buildSemanticText, buildOnSemantic } from "./semanticText.js";
|
|
7
7
|
import { buildFocusRing } from "./focusRing.js";
|
|
8
8
|
import { buildSurfaceRaised } from "./surfaceRaised.js";
|
|
9
|
+
import { buildStar } from "./star.js";
|
|
9
10
|
// Structural ramps are rebuilt at explicit targets (not reversed — light ramps bottom near 35%);
|
|
10
11
|
// utility hues are reversed so index roles survive; brand/semantic ramps shift one step lighter.
|
|
11
12
|
const SCALE_KEYS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
|
|
@@ -203,6 +204,7 @@ export function buildDarkPalette(light) {
|
|
|
203
204
|
onSemantic: buildOnSemantic(semantic, light.white, light.black),
|
|
204
205
|
focusRing: buildFocusRing({ primary, background, backgroundColor: namedSurfaces }),
|
|
205
206
|
surfaceRaised: buildSurfaceRaised({ backgroundColor: namedSurfaces, background, white }),
|
|
207
|
+
star: buildStar(namedSurfaces.main),
|
|
206
208
|
sidebar: withSidebarTokens(light),
|
|
207
209
|
boxShadow: {
|
|
208
210
|
primary: buildPrimaryShadowTint(primary[500]),
|