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,14 @@
|
|
|
1
|
+
import type { StockState } from "../Commerce/commerceTypes";
|
|
2
|
+
/** Text size; the dot scales with it. */
|
|
3
|
+
export type StockStatusSize = "sm" | "md";
|
|
4
|
+
/** Availability as a dot plus words, never colour alone. */
|
|
5
|
+
export interface StockStatusProps {
|
|
6
|
+
/** Availability: in-stock and low-stock read as success and warning, backorder as info, out-of-stock as muted. */
|
|
7
|
+
status: StockState;
|
|
8
|
+
/** Units left; shown as "Only 3 left" for low-stock only, ignored for every other state. */
|
|
9
|
+
count?: number;
|
|
10
|
+
/** Replaces the default words, e.g. "In stock · ships within 24 hours". */
|
|
11
|
+
message?: string;
|
|
12
|
+
size?: StockStatusSize;
|
|
13
|
+
"data-testid"?: string;
|
|
14
|
+
}
|
|
@@ -25,6 +25,7 @@ const rowMetrics_1 = require("./components/rowMetrics");
|
|
|
25
25
|
const scrollbar_1 = require("../../Theme/tokens/builders/scrollbar");
|
|
26
26
|
const scrollShadow_1 = require("../../Theme/tokens/builders/scrollShadow");
|
|
27
27
|
const useTable_1 = __importDefault(require("./hooks/useTable"));
|
|
28
|
+
const columnLabel_1 = require("./columnLabel");
|
|
28
29
|
const table_1 = require("../../Utils/table");
|
|
29
30
|
const usePreferences_1 = require("../../Hooks/usePreferences");
|
|
30
31
|
const TableSettings_1 = __importDefault(require("./settings/TableSettings"));
|
|
@@ -171,7 +172,7 @@ function Table({ data, columns, onSelection, isLoading, isCheckbox = false, free
|
|
|
171
172
|
}, [tablePreferences === null || tablePreferences === void 0 ? void 0 : tablePreferences.groupBy]);
|
|
172
173
|
const handleDensityChange = (d) => {
|
|
173
174
|
setDensityState(d);
|
|
174
|
-
savePreferences === null || savePreferences === void 0 ? void 0 : savePreferences({ ...tablePreferences, columns: columnsList, groupBy: groupByState !== null && groupByState !== void 0 ? groupByState : null, density: d });
|
|
175
|
+
savePreferences === null || savePreferences === void 0 ? void 0 : savePreferences({ ...tablePreferences, columns: (0, columnLabel_1.toSavedColumns)(columnsList), groupBy: groupByState !== null && groupByState !== void 0 ? groupByState : null, density: d });
|
|
175
176
|
};
|
|
176
177
|
// Settings "Save": persist columns + group (+ current density) in ONE write so
|
|
177
178
|
// they don't clobber each other, and apply them locally.
|
|
@@ -62,7 +62,7 @@ export type TableProps = {
|
|
|
62
62
|
isPagination?: boolean;
|
|
63
63
|
/** Controlled selected row ids; a new array replaces the internal selection. */
|
|
64
64
|
selections?: (string | number)[];
|
|
65
|
-
/** Fires per cell, gated on the column: a column with `node` swallows its clicks. */
|
|
65
|
+
/** Fires per cell, gated on the column: a column with `node` swallows its clicks. A node `label` arrives as its plain text. */
|
|
66
66
|
onRowClick?: (row: DataObject, header: Record<string | number, string | number>) => void;
|
|
67
67
|
/** Sticky-positions the trailing action/link column during horizontal scroll. Defaults true. */
|
|
68
68
|
isActionFreeze?: boolean;
|
|
@@ -169,7 +169,10 @@ export type HeaderActionsProps = {
|
|
|
169
169
|
};
|
|
170
170
|
/** Column definition: label, sort/search/freeze flags, and optional status or custom cell renderer. */
|
|
171
171
|
export type TableHeaderProps = {
|
|
172
|
-
|
|
172
|
+
/** Header content. A node (icon, tooltip trigger) renders as-is but is clipped, not ellipsized, when too wide. */
|
|
173
|
+
label: string | number | ReactNode;
|
|
174
|
+
/** Plain-text name for a node `label` — used by the sort/filter button names, Manage Columns, Group, filter chips and saved preferences. Ignored for a string/number label. Omitted: the node's text children, else `id`. */
|
|
175
|
+
labelText?: string;
|
|
173
176
|
id: string | number;
|
|
174
177
|
/** Enables the multi-column sort control; sorts client-side only — server mode never reorders rows. */
|
|
175
178
|
isSort?: boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TableHeaderProps } from "./TableProps";
|
|
2
|
+
export declare const isPrimitiveLabel: (label: unknown) => label is string | number;
|
|
3
|
+
/** Plain-text name of a column, for every place a node cannot go: aria-labels, settings, chips, saved preferences. */
|
|
4
|
+
export declare const columnLabelText: (column: Pick<TableHeaderProps, "id" | "label" | "labelText">) => string;
|
|
5
|
+
/** Columns as they may be POSTed: a node label is swapped for its text, since elements are not JSON. */
|
|
6
|
+
export declare const toSavedColumns: (columns: TableHeaderProps[]) => TableHeaderProps[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toSavedColumns = exports.columnLabelText = exports.isPrimitiveLabel = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const isPrimitiveLabel = (label) => typeof label === "string" || typeof label === "number";
|
|
6
|
+
exports.isPrimitiveLabel = isPrimitiveLabel;
|
|
7
|
+
const textOf = (node) => {
|
|
8
|
+
if ((0, exports.isPrimitiveLabel)(node))
|
|
9
|
+
return String(node);
|
|
10
|
+
if (Array.isArray(node))
|
|
11
|
+
return node.map(textOf).join("");
|
|
12
|
+
if ((0, react_1.isValidElement)(node))
|
|
13
|
+
return textOf(node.props.children);
|
|
14
|
+
return "";
|
|
15
|
+
};
|
|
16
|
+
/** Plain-text name of a column, for every place a node cannot go: aria-labels, settings, chips, saved preferences. */
|
|
17
|
+
const columnLabelText = (column) => {
|
|
18
|
+
if ((0, exports.isPrimitiveLabel)(column.label))
|
|
19
|
+
return String(column.label);
|
|
20
|
+
if (column.labelText)
|
|
21
|
+
return column.labelText;
|
|
22
|
+
return textOf(column.label).replace(/\s+/g, " ").trim() || String(column.id);
|
|
23
|
+
};
|
|
24
|
+
exports.columnLabelText = columnLabelText;
|
|
25
|
+
/** Columns as they may be POSTed: a node label is swapped for its text, since elements are not JSON. */
|
|
26
|
+
const toSavedColumns = (columns) => columns.map((column) => (0, exports.isPrimitiveLabel)(column.label) ? column : { ...column, label: (0, exports.columnLabelText)(column) });
|
|
27
|
+
exports.toSavedColumns = toSavedColumns;
|
|
@@ -51,6 +51,7 @@ const TableVariantContext_1 = require("../variants/TableVariantContext");
|
|
|
51
51
|
const pillInk_1 = require("../variants/pillInk");
|
|
52
52
|
const EmptyState_1 = __importDefault(require("../../EmptyState/EmptyState"));
|
|
53
53
|
const rowMetrics_1 = require("./rowMetrics");
|
|
54
|
+
const columnLabel_1 = require("../columnLabel");
|
|
54
55
|
const motion_1 = require("../../../Theme/tokens/primitives/motion");
|
|
55
56
|
const motion_2 = require("../../../Theme/chakra/motion");
|
|
56
57
|
const getRowId = (row) => row.id;
|
|
@@ -120,7 +121,10 @@ const TableRow = react_2.default.memo(({ row, rowIndex, isChecked, isExpanded, i
|
|
|
120
121
|
}, [onMeasure, isExpanded, hasContent, row]);
|
|
121
122
|
const handleCellClick = (0, react_2.useCallback)((header) => {
|
|
122
123
|
if (!header.node && onRowClick) {
|
|
123
|
-
onRowClick(row, {
|
|
124
|
+
onRowClick(row, {
|
|
125
|
+
label: (0, columnLabel_1.isPrimitiveLabel)(header.label) ? header.label : (0, columnLabel_1.columnLabelText)(header),
|
|
126
|
+
id: header.id,
|
|
127
|
+
});
|
|
124
128
|
}
|
|
125
129
|
}, [row, onRowClick]);
|
|
126
130
|
const variant = (0, TableVariantContext_1.useTableVariant)();
|
|
@@ -10,6 +10,7 @@ const table_1 = require("../../../Utils/table");
|
|
|
10
10
|
const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
11
11
|
const accentText_1 = require("../../../Theme/tokens/builders/accentText");
|
|
12
12
|
const TableFilters_1 = __importDefault(require("../filters/TableFilters"));
|
|
13
|
+
const columnLabel_1 = require("../columnLabel");
|
|
13
14
|
const lucide_react_1 = require("lucide-react");
|
|
14
15
|
const Checkbox_1 = __importDefault(require("../../Checkbox/Checkbox"));
|
|
15
16
|
const TableVariantContext_1 = require("../variants/TableVariantContext");
|
|
@@ -22,7 +23,7 @@ const TableHeader = ({ columns, isCheckbox, handleSort, headerRefs, columnWidths
|
|
|
22
23
|
return ((0, jsx_runtime_1.jsxs)(react_1.Tr, { pr: 0, "aria-rowindex": 1, children: [isContent && (0, jsx_runtime_1.jsx)(ContentSpacerCell, { noBorders: noBorders }), isCheckbox && ((0, jsx_runtime_1.jsx)(SelectAllCell, { slotRef: slotRef, freezedTextColor: freezedTextColor, noBorders: noBorders, isSelecting: isSelecting, isLoading: isLoading, checked: checked, handleCheckbox: handleCheckbox })), columns.map((header, index) => {
|
|
23
24
|
if (header === null || header === void 0 ? void 0 : header.isHidden)
|
|
24
25
|
return null;
|
|
25
|
-
return ((0, jsx_runtime_1.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 },
|
|
26
|
+
return ((0, jsx_runtime_1.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 }, (0, columnLabel_1.columnLabelText)(header)));
|
|
26
27
|
}), isLink && (0, jsx_runtime_1.jsx)(ViewSpacerCell, { noBorders: noBorders, isActionFreeze: isActionFreeze })] }));
|
|
27
28
|
};
|
|
28
29
|
exports.default = (0, react_2.memo)(TableHeader);
|
|
@@ -96,7 +97,7 @@ const ColumnHeader = (0, react_2.memo)(({ header, index, columnWidths, slotWidth
|
|
|
96
97
|
!!columnsSearch[header.id];
|
|
97
98
|
return ((0, jsx_runtime_1.jsx)(react_1.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
|
|
98
99
|
? "none"
|
|
99
|
-
: `0.063rem solid ${variant.header.ruleColor}`, className: `columns ${isFrozen ? "sticky-columns" : "scrollable-columns"}`, height: variant.header.height, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: (0, jsx_runtime_1.jsxs)(react_1.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: [(0, jsx_runtime_1.jsx)(react_1.Box, { textAlign: align, textOverflow: "ellipsis", whiteSpace: "nowrap", display: "inline-block", overflow: "hidden", children: header.label }), (0, jsx_runtime_1.jsxs)(react_1.Box, { display: "inline-flex", alignItems: "center", opacity: showActions ? 1 : 0, transition: (0, motion_1.transitionFor)(["opacity"], "base"), sx: (0, motion_2.reducedMotionSx)(), _focusWithin: { opacity: 1 }, children: [header.isSort && ((0, jsx_runtime_1.jsx)(SortingIcon, { label:
|
|
100
|
+
: `0.063rem solid ${variant.header.ruleColor}`, className: `columns ${isFrozen ? "sticky-columns" : "scrollable-columns"}`, height: variant.header.height, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: (0, jsx_runtime_1.jsxs)(react_1.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: [(0, jsx_runtime_1.jsx)(react_1.Box, { textAlign: align, textOverflow: "ellipsis", whiteSpace: "nowrap", display: "inline-block", overflow: "hidden", children: header.label }), (0, jsx_runtime_1.jsxs)(react_1.Box, { display: "inline-flex", alignItems: "center", opacity: showActions ? 1 : 0, transition: (0, motion_1.transitionFor)(["opacity"], "base"), sx: (0, motion_2.reducedMotionSx)(), _focusWithin: { opacity: 1 }, children: [header.isSort && ((0, jsx_runtime_1.jsx)(SortingIcon, { label: (0, columnLabel_1.columnLabelText)(header), sortState: (_b = isSorting === null || isSorting === void 0 ? void 0 : isSorting.direction) !== null && _b !== void 0 ? _b : "none", isVisible: isHovered || isSortActive, handleSortClick: () => {
|
|
100
101
|
let direction = "asc";
|
|
101
102
|
if ((isSorting === null || isSorting === void 0 ? void 0 : isSorting.direction) === "asc") {
|
|
102
103
|
direction = "desc";
|
|
@@ -45,6 +45,7 @@ const accentText_1 = require("../../../Theme/tokens/builders/accentText");
|
|
|
45
45
|
const tone_1 = require("../../../Theme/tokens/builders/tone");
|
|
46
46
|
const scrollbar_1 = require("../../../Theme/tokens/builders/scrollbar");
|
|
47
47
|
const focusRing_styles_1 = require("../../../Theme/chakra/focusRing.styles");
|
|
48
|
+
const columnLabel_1 = require("../columnLabel");
|
|
48
49
|
const Divider_1 = __importDefault(require("../../Divider/Divider"));
|
|
49
50
|
const ActiveFilters = react_1.default.memo(({ columns, columnsSearch, setColumnsSearch, }) => {
|
|
50
51
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
@@ -52,7 +53,7 @@ const ActiveFilters = react_1.default.memo(({ columns, columnsSearch, setColumns
|
|
|
52
53
|
const columnLabelMap = (0, react_1.useMemo)(() => {
|
|
53
54
|
const map = new Map();
|
|
54
55
|
for (const col of columns) {
|
|
55
|
-
map.set(col.id,
|
|
56
|
+
map.set(col.id, (0, columnLabel_1.columnLabelText)(col));
|
|
56
57
|
}
|
|
57
58
|
return map;
|
|
58
59
|
}, [columns]);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const react_2 = require("@chakra-ui/react");
|
|
6
|
+
const columnLabel_1 = require("../columnLabel");
|
|
6
7
|
const lucide_react_1 = require("lucide-react");
|
|
7
8
|
const TableFilters = (0, react_1.memo)(({ header, setColumnsSearch, columnsSearch, onClose, isOpen, onOpen, }) => {
|
|
8
9
|
const theme = (0, react_2.useTheme)();
|
|
@@ -38,7 +39,7 @@ const TableFilters = (0, react_1.memo)(({ header, setColumnsSearch, columnsSearc
|
|
|
38
39
|
setRefreshDataOnOpen((prev) => !prev);
|
|
39
40
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
40
41
|
};
|
|
41
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.Popover, { isOpen: isOpen, onClose: onClose, onOpen: handleOpen, children: [(0, jsx_runtime_1.jsx)(react_2.PopoverTrigger, { children: (0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": `Filter ${header
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Popover, { isOpen: isOpen, onClose: onClose, onOpen: handleOpen, children: [(0, jsx_runtime_1.jsx)(react_2.PopoverTrigger, { children: (0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": `Filter ${(0, columnLabel_1.columnLabelText)(header)}`, icon: (0, jsx_runtime_1.jsx)(lucide_react_1.EllipsisVertical, { size: 17, color: theme.colors.primary[900] }), size: "xs", variant: "ghost", _hover: { bg: "none" } }) }), (0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsx)(react_2.PopoverContent, { width: "200px", bg: theme.colors.surfaceRaised, children: (0, jsx_runtime_1.jsx)(react_2.PopoverBody, { p: 2, children: (0, jsx_runtime_1.jsxs)(react_2.InputGroup, { flex: "1", size: "xs", children: [(0, jsx_runtime_1.jsx)(react_2.InputLeftElement, { pointerEvents: "none", children: (0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.Search, color: theme.colors.textMuted, boxSize: 4 }) }), (0, jsx_runtime_1.jsx)(react_2.Input, { autoFocus: true, placeholder: `Search ${(0, columnLabel_1.columnLabelText)(header)}...`, size: "xs", ref: searchRef, onChange: (e) => {
|
|
42
43
|
e.stopPropagation();
|
|
43
44
|
debouncedSearch(e.target.value);
|
|
44
45
|
}, onFocus: (e) => e.stopPropagation() })] }) }) }) })] }));
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DEFAULT_PAGE_SIZE = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const table_1 = require("../../../Utils/table");
|
|
6
|
+
const columnLabel_1 = require("../columnLabel");
|
|
6
7
|
exports.DEFAULT_PAGE_SIZE = 20;
|
|
7
8
|
const defaultPageSize = exports.DEFAULT_PAGE_SIZE;
|
|
8
9
|
const mergeColumnWithPreference = (pref, originalCol) => {
|
|
@@ -13,7 +14,7 @@ const mergeColumnWithPreference = (pref, originalCol) => {
|
|
|
13
14
|
const next = { ...originalCol };
|
|
14
15
|
next.isHidden =
|
|
15
16
|
typeof pref.isHidden === "boolean" ? pref.isHidden : (_a = originalCol === null || originalCol === void 0 ? void 0 : originalCol.isHidden) !== null && _a !== void 0 ? _a : false;
|
|
16
|
-
if (
|
|
17
|
+
if ((0, columnLabel_1.isPrimitiveLabel)(pref.label) && (0, columnLabel_1.isPrimitiveLabel)(originalCol === null || originalCol === void 0 ? void 0 : originalCol.label)) {
|
|
17
18
|
next.label = pref.label;
|
|
18
19
|
}
|
|
19
20
|
return next;
|
|
@@ -220,7 +221,7 @@ const useTable = ({ data, isPagination, selections, onSelection, tablePreference
|
|
|
220
221
|
if (savePreferences) {
|
|
221
222
|
savePreferences({
|
|
222
223
|
...tablePreferences,
|
|
223
|
-
columns: columns,
|
|
224
|
+
columns: (0, columnLabel_1.toSavedColumns)(columns),
|
|
224
225
|
...extra,
|
|
225
226
|
});
|
|
226
227
|
}
|
|
@@ -11,6 +11,7 @@ const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
|
11
11
|
const scrollbar_1 = require("../../../Theme/tokens/builders/scrollbar");
|
|
12
12
|
const accentText_1 = require("../../../Theme/tokens/builders/accentText");
|
|
13
13
|
const rowStates_1 = require("../../../Theme/tokens/builders/rowStates");
|
|
14
|
+
const columnLabel_1 = require("../columnLabel");
|
|
14
15
|
const lucide_react_1 = require("lucide-react");
|
|
15
16
|
const motion_1 = require("../../../Theme/tokens/primitives/motion");
|
|
16
17
|
const ManageColumns = ({ columns, items, setItems, childInputMethodsRef, }) => {
|
|
@@ -66,7 +67,7 @@ const ManageColumns = ({ columns, items, setItems, childInputMethodsRef, }) => {
|
|
|
66
67
|
setItems(newItems);
|
|
67
68
|
setError(null);
|
|
68
69
|
};
|
|
69
|
-
const filteredItems = items.filter((item) =>
|
|
70
|
+
const filteredItems = items.filter((item) => (0, columnLabel_1.columnLabelText)(item).toLowerCase().includes(searchTerm.toLowerCase()));
|
|
70
71
|
const allChecked = items.every((item) => !item.isHidden);
|
|
71
72
|
const someChecked = items.some((item) => !item.isHidden) && !allChecked;
|
|
72
73
|
const handleSelectAll = () => {
|
|
@@ -92,9 +93,9 @@ const ManageColumns = ({ columns, items, setItems, childInputMethodsRef, }) => {
|
|
|
92
93
|
: "transparent", cursor: "grab", fontSize: "13px", px: 2, py: "3px", mb: "3px", transition: (0, motion_1.transitionFor)(["background-color", "border-color"]), _hover: {
|
|
93
94
|
bg: rowBackgrounds.active,
|
|
94
95
|
borderColor: theme.colors.boxborder[200],
|
|
95
|
-
}, _active: { cursor: "grabbing" }, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", "aria-hidden": "true", display: "inline-flex", cursor: "grab", mr: 1, _hover: { color: theme.colors.textMuted }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.GripVertical, { size: 14 }) }), (0, jsx_runtime_1.jsx)(Checkbox_1.default, { isChecked: !item.isHidden, label:
|
|
96
|
+
}, _active: { cursor: "grabbing" }, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", "aria-hidden": "true", display: "inline-flex", cursor: "grab", mr: 1, _hover: { color: theme.colors.textMuted }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.GripVertical, { size: 14 }) }), (0, jsx_runtime_1.jsx)(Checkbox_1.default, { isChecked: !item.isHidden, label: (0, columnLabel_1.columnLabelText)(item), onChange: () => toggleCheckbox(item.id), size: "sm", labelSx: {
|
|
96
97
|
color: item.isHidden ? theme.colors.textMuted : theme.colors.text[700],
|
|
97
|
-
} }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "12px", color: theme.colors.textMuted, ml: 'auto', children: index + 1 }), (0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": `Move ${item
|
|
98
|
+
} }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "12px", color: theme.colors.textMuted, ml: 'auto', children: index + 1 }), (0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": `Move ${(0, columnLabel_1.columnLabelText)(item)} up`, icon: (0, jsx_runtime_1.jsx)(lucide_react_1.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) }), (0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": `Move ${(0, columnLabel_1.columnLabelText)(item)} down`, icon: (0, jsx_runtime_1.jsx)(lucide_react_1.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));
|
|
98
99
|
})) : ((0, jsx_runtime_1.jsx)(react_2.Text, { color: theme.colors.textMuted, textAlign: "center", fontSize: "sm", py: 6, children: "No columns found" })) }), (0, jsx_runtime_1.jsxs)(react_2.Text, { fontSize: "xs", color: theme.colors.textMuted, mt: 2, textAlign: "right", children: [visibleCount, " / ", items.length, " visible"] })] }));
|
|
99
100
|
};
|
|
100
101
|
exports.default = ManageColumns;
|
|
@@ -11,6 +11,7 @@ const ManageColumns_1 = __importDefault(require("./ManageColumns"));
|
|
|
11
11
|
const Button_1 = __importDefault(require("../../Button/Button"));
|
|
12
12
|
const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
13
13
|
const scrollbar_1 = require("../../../Theme/tokens/builders/scrollbar");
|
|
14
|
+
const columnLabel_1 = require("../columnLabel");
|
|
14
15
|
const lucide_react_1 = require("lucide-react");
|
|
15
16
|
const ToolTip_1 = __importDefault(require("../../ToolTip/ToolTip"));
|
|
16
17
|
const rowStates_1 = require("../../../Theme/tokens/builders/rowStates");
|
|
@@ -72,7 +73,7 @@ const TableSettings = ({ columns, onSave, density = "normal", onDensityChange, g
|
|
|
72
73
|
// Only columns that declare a `columnType` are groupable.
|
|
73
74
|
...columns
|
|
74
75
|
.filter((c) => !!c.columnType && !c.isHidden)
|
|
75
|
-
.map((c) => ({ id: c.id, label:
|
|
76
|
+
.map((c) => ({ id: c.id, label: (0, columnLabel_1.columnLabelText)(c) }))]
|
|
76
77
|
.map((opt) => {
|
|
77
78
|
var _a;
|
|
78
79
|
const selected = selectedGroup === opt.id;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TrustBadgesProps } from "./TrustBadgesProps";
|
|
2
|
+
/** Reassurance items (returns, COD, authenticity, secure payments) on calm tonal tiles; the title always carries the meaning. */
|
|
3
|
+
declare const TrustBadges: ({ items, layout, "aria-label": ariaLabel, "data-testid": testId }: TrustBadgesProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
export default TrustBadges;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("@chakra-ui/react");
|
|
5
|
+
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
6
|
+
const DEFAULT_LABEL = "Why shop with us";
|
|
7
|
+
const LIST_STYLES = {
|
|
8
|
+
row: { display: "flex", flexWrap: "wrap" },
|
|
9
|
+
grid: { display: "grid", gridTemplateColumns: "repeat(2, minmax(0, 1fr))" },
|
|
10
|
+
stack: { display: "flex", flexDirection: "column" },
|
|
11
|
+
};
|
|
12
|
+
/** Reassurance items (returns, COD, authenticity, secure payments) on calm tonal tiles; the title always carries the meaning. */
|
|
13
|
+
const TrustBadges = ({ items, layout = "row", "aria-label": ariaLabel = DEFAULT_LABEL, "data-testid": testId }) => {
|
|
14
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
15
|
+
if (items.length === 0)
|
|
16
|
+
return null;
|
|
17
|
+
const stacked = layout === "stack";
|
|
18
|
+
const tile = (item) => {
|
|
19
|
+
var _a;
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.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: [(0, jsx_runtime_1.jsx)(react_1.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 }), (0, jsx_runtime_1.jsxs)(react_1.Box, { minW: 0, children: [(0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "sm", fontWeight: 600, lineHeight: 1.35, color: colors.header[900], children: item.title }), item.detail ? ((0, jsx_runtime_1.jsx)(react_1.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));
|
|
21
|
+
};
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(react_1.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) }));
|
|
23
|
+
};
|
|
24
|
+
exports.default = TrustBadges;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** One reassurance, e.g. "7-day easy returns". */
|
|
3
|
+
export interface TrustItem {
|
|
4
|
+
/** Stable key; falls back to the title. */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** A lucide icon element; decorative, so the title always carries the meaning. */
|
|
7
|
+
icon: ReactNode;
|
|
8
|
+
title: string;
|
|
9
|
+
detail?: string;
|
|
10
|
+
}
|
|
11
|
+
/** `row` is a wrapping horizontal strip, `grid` an even two-column grid, `stack` a vertical list. */
|
|
12
|
+
export type TrustBadgesLayout = "row" | "grid" | "stack";
|
|
13
|
+
/** Reassurance items (returns, COD, authenticity, secure payments) on a tonal tile. */
|
|
14
|
+
export interface TrustBadgesProps {
|
|
15
|
+
items: TrustItem[];
|
|
16
|
+
layout?: TrustBadgesLayout;
|
|
17
|
+
/** Accessible name of the list. */
|
|
18
|
+
"aria-label"?: string;
|
|
19
|
+
"data-testid"?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { VariantSelectorProps } from "./VariantSelectorProps";
|
|
2
|
+
/** Per-axis radiogroups whose availability is derived from `variants`; no vertical-specific vocabulary lives here. */
|
|
3
|
+
declare const VariantSelector: ({ axes, variants, value, defaultValue, onValueChange, error, showSelectedLabel, showLowStock, size, layout, onGuideClick, "data-testid": testId, }: VariantSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default VariantSelector;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_2 = require("@chakra-ui/react");
|
|
9
|
+
const lucide_react_1 = require("lucide-react");
|
|
10
|
+
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
11
|
+
const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
|
|
12
|
+
const scrollbar_1 = require("../../Theme/tokens/builders/scrollbar");
|
|
13
|
+
const OptionChip_1 = __importDefault(require("../OptionChip/OptionChip"));
|
|
14
|
+
const commerceVariants_1 = require("../Commerce/commerceVariants");
|
|
15
|
+
const variantSelection_1 = require("./variantSelection");
|
|
16
|
+
const GAP = "0.5rem";
|
|
17
|
+
const GRID_MIN = {
|
|
18
|
+
chip: "4rem",
|
|
19
|
+
swatch: "3rem",
|
|
20
|
+
"image-tile": "4.75rem",
|
|
21
|
+
pack: "6.5rem",
|
|
22
|
+
};
|
|
23
|
+
const cellKey = (axisId, valueId) => `${axisId}\u0000${valueId}`;
|
|
24
|
+
/** Per-axis radiogroups whose availability is derived from `variants`; no vertical-specific vocabulary lives here. */
|
|
25
|
+
const VariantSelector = ({ axes, variants, value, defaultValue, onValueChange, error, showSelectedLabel = false, showLowStock = false, size = "md", layout = "wrap", onGuideClick, "data-testid": testId, }) => {
|
|
26
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
27
|
+
const uid = (0, react_1.useId)();
|
|
28
|
+
const statusId = `${uid}-status`;
|
|
29
|
+
const cells = (0, react_1.useRef)(new Map());
|
|
30
|
+
const [inner, setInner] = (0, react_1.useState)(defaultValue !== null && defaultValue !== void 0 ? defaultValue : {});
|
|
31
|
+
const [focus, setFocus] = (0, react_1.useState)(null);
|
|
32
|
+
const selection = value !== null && value !== void 0 ? value : inner;
|
|
33
|
+
const commit = (0, react_1.useCallback)((next) => {
|
|
34
|
+
if ((0, variantSelection_1.sameSelection)(next, selection))
|
|
35
|
+
return;
|
|
36
|
+
if (value === undefined)
|
|
37
|
+
setInner(next);
|
|
38
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(next, (0, commerceVariants_1.findVariant)(axes, variants, next));
|
|
39
|
+
}, [axes, variants, selection, value, onValueChange]);
|
|
40
|
+
const choose = (axisId, valueId) => {
|
|
41
|
+
if ((0, variantSelection_1.isSoldOutEverywhere)(variants, axisId, valueId))
|
|
42
|
+
return;
|
|
43
|
+
commit((0, variantSelection_1.selectValue)(axes, variants, selection, axisId, valueId));
|
|
44
|
+
};
|
|
45
|
+
const lowStockHint = (axis, option) => {
|
|
46
|
+
if (!showLowStock)
|
|
47
|
+
return undefined;
|
|
48
|
+
const left = (0, commerceVariants_1.remainingStock)(variants, selection, axis.id, option.id);
|
|
49
|
+
if (left === undefined || left <= 0 || left > commerceVariants_1.LOW_STOCK_THRESHOLD)
|
|
50
|
+
return undefined;
|
|
51
|
+
return `${left} left`;
|
|
52
|
+
};
|
|
53
|
+
const hintFor = (axis, option) => {
|
|
54
|
+
const low = lowStockHint(axis, option);
|
|
55
|
+
if (!low)
|
|
56
|
+
return option.hint;
|
|
57
|
+
return axis.type === "pack" && option.hint ? `${option.hint} · ${low}` : low;
|
|
58
|
+
};
|
|
59
|
+
const onKeyDown = (axis) => (event) => {
|
|
60
|
+
var _a;
|
|
61
|
+
const index = axis.values.findIndex((option) => cells.current.get(cellKey(axis.id, option.id)) === document.activeElement);
|
|
62
|
+
if (index < 0)
|
|
63
|
+
return;
|
|
64
|
+
const last = axis.values.length - 1;
|
|
65
|
+
const target = event.key === "ArrowRight" || event.key === "ArrowDown"
|
|
66
|
+
? (index + 1) % axis.values.length
|
|
67
|
+
: event.key === "ArrowLeft" || event.key === "ArrowUp"
|
|
68
|
+
? (index - 1 + axis.values.length) % axis.values.length
|
|
69
|
+
: event.key === "Home"
|
|
70
|
+
? 0
|
|
71
|
+
: event.key === "End"
|
|
72
|
+
? last
|
|
73
|
+
: -1;
|
|
74
|
+
if (target < 0)
|
|
75
|
+
return;
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
const next = axis.values[target];
|
|
78
|
+
(_a = cells.current.get(cellKey(axis.id, next.id))) === null || _a === void 0 ? void 0 : _a.focus();
|
|
79
|
+
setFocus({ axisId: axis.id, valueId: next.id });
|
|
80
|
+
if ((0, commerceVariants_1.isOptionAvailable)(variants, selection, axis.id, next.id))
|
|
81
|
+
choose(axis.id, next.id);
|
|
82
|
+
};
|
|
83
|
+
const containerStyles = (axis) => {
|
|
84
|
+
if (layout === "grid") {
|
|
85
|
+
return { display: "grid", gridTemplateColumns: `repeat(auto-fill, minmax(${GRID_MIN[axis.type]}, 1fr))`, gap: GAP };
|
|
86
|
+
}
|
|
87
|
+
if (layout === "scroll") {
|
|
88
|
+
return {
|
|
89
|
+
display: "flex",
|
|
90
|
+
flexWrap: "nowrap",
|
|
91
|
+
gap: GAP,
|
|
92
|
+
overflowX: "auto",
|
|
93
|
+
pt: "0.5rem",
|
|
94
|
+
mt: "-0.5rem",
|
|
95
|
+
pr: "0.5rem",
|
|
96
|
+
scrollSnapType: "x proximity",
|
|
97
|
+
sx: (0, scrollbar_1.scrollbarStyles)(colors, "hover"),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return { display: "flex", flexWrap: "wrap", gap: GAP, pt: "0.25rem" };
|
|
101
|
+
};
|
|
102
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { direction: "column", gap: 5, "data-testid": testId, children: [axes.map((axis) => {
|
|
103
|
+
var _a, _b;
|
|
104
|
+
const labelId = `${uid}-${axis.id}-label`;
|
|
105
|
+
const picked = axis.values.find((option) => option.id === selection[axis.id]);
|
|
106
|
+
const unpicked = selection[axis.id] === undefined;
|
|
107
|
+
const invalid = !!error && unpicked;
|
|
108
|
+
const available = axis.values.map((option) => (0, commerceVariants_1.isOptionAvailable)(variants, selection, axis.id, option.id));
|
|
109
|
+
const firstAvailable = (_a = axis.values.find((_, i) => available[i])) !== null && _a !== void 0 ? _a : axis.values[0];
|
|
110
|
+
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;
|
|
111
|
+
const { guide } = axis;
|
|
112
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "baseline", justify: "space-between", gap: 3, mb: 3, children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "baseline", gap: 2, minW: 0, children: [(0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", id: labelId, fontSize: "sm", fontWeight: 600, color: colors.header[900], children: axis.label }), showSelectedLabel && picked ? ((0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", fontSize: "sm", color: colors.textMuted, noOfLines: 1, children: picked.label })) : null] }), guide ? ((0, jsx_runtime_1.jsxs)(react_2.Box, { as: "button", type: "button", display: "inline-flex", alignItems: "center", gap: 1, flexShrink: 0, fontSize: "sm", fontWeight: 600, color: colors.accentText, borderRadius: "md", onClick: () => {
|
|
113
|
+
guide.onClick();
|
|
114
|
+
onGuideClick === null || onGuideClick === void 0 ? void 0 : onGuideClick(axis.id);
|
|
115
|
+
}, sx: (0, focusRing_styles_1.focusVisibleStyles)(colors), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Ruler, { size: 14, "aria-hidden": true }), guide.label] })) : null] }), (0, jsx_runtime_1.jsx)(react_2.Box, { role: "radiogroup", "aria-labelledby": labelId, "aria-invalid": invalid || undefined, "aria-describedby": invalid ? statusId : undefined, onKeyDown: onKeyDown(axis), onBlur: (event) => {
|
|
116
|
+
if (!event.currentTarget.contains(event.relatedTarget))
|
|
117
|
+
setFocus(null);
|
|
118
|
+
}, ...containerStyles(axis), children: axis.values.map((option, i) => ((0, jsx_runtime_1.jsx)(OptionChip_1.default, { ref: (node) => {
|
|
119
|
+
cells.current.set(cellKey(axis.id, option.id), node);
|
|
120
|
+
}, 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));
|
|
121
|
+
}), (0, jsx_runtime_1.jsx)(react_2.Box, { role: "status", id: statusId, "aria-live": "polite", mt: error ? -2 : 0, children: error ? ((0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 1.5, color: colors.semanticText.error, fontSize: "sm", fontWeight: 600, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CircleAlert, { size: 14, "aria-hidden": true }), (0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", children: error })] })) : null })] }));
|
|
122
|
+
};
|
|
123
|
+
exports.default = VariantSelector;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { OptionAxis, ProductVariant, VariantSelection } from "../Commerce/commerceTypes";
|
|
2
|
+
import type { OptionChipSize } from "../OptionChip/OptionChipProps";
|
|
3
|
+
/** How an axis lays out its options: wrapping rows, one horizontal scroller, or an even grid (which also prints swatch names). */
|
|
4
|
+
export type VariantSelectorLayout = "wrap" | "scroll" | "grid";
|
|
5
|
+
/** Config-driven option picker for any product vertical; every axis label and value comes from `axes`. */
|
|
6
|
+
export interface VariantSelectorProps {
|
|
7
|
+
/** One radiogroup per axis, in order. */
|
|
8
|
+
axes: OptionAxis[];
|
|
9
|
+
/** Availability is derived per combination from these variants' stock. */
|
|
10
|
+
variants: ProductVariant[];
|
|
11
|
+
/** Controlled selection, axis id to option value id. */
|
|
12
|
+
value?: VariantSelection;
|
|
13
|
+
defaultValue?: VariantSelection;
|
|
14
|
+
/** Receives the new selection and the matching variant, or undefined while the selection is incomplete or has no variant. */
|
|
15
|
+
onValueChange?: (selection: VariantSelection, variant: ProductVariant | undefined) => void;
|
|
16
|
+
/** Prompt such as "Select a size": shown as a status message and rings every axis still unpicked. */
|
|
17
|
+
error?: string;
|
|
18
|
+
/** Prints the picked value beside each axis label ("Colour Indigo Wash"). */
|
|
19
|
+
showSelectedLabel?: boolean;
|
|
20
|
+
/** Tags a value "N left" only when its real remaining stock is at or under LOW_STOCK_THRESHOLD. */
|
|
21
|
+
showLowStock?: boolean;
|
|
22
|
+
size?: OptionChipSize;
|
|
23
|
+
layout?: VariantSelectorLayout;
|
|
24
|
+
/** Also called when an axis `guide` link is clicked, after the guide's own onClick. */
|
|
25
|
+
onGuideClick?: (axisId: string) => void;
|
|
26
|
+
"data-testid"?: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OptionAxis, ProductVariant, VariantSelection } from "../Commerce/commerceTypes";
|
|
2
|
+
/** Picks `valueId` on `axisId`, then drops every other pick that no sellable variant can pair with it. */
|
|
3
|
+
export declare const selectValue: (axes: OptionAxis[], variants: ProductVariant[], selection: VariantSelection, axisId: string, valueId: string) => VariantSelection;
|
|
4
|
+
/** Sold out under every combination, so picking it can never lead to a purchasable variant. */
|
|
5
|
+
export declare const isSoldOutEverywhere: (variants: ProductVariant[], axisId: string, valueId: string) => boolean;
|
|
6
|
+
export declare const sameSelection: (a: VariantSelection, b: VariantSelection) => boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sameSelection = exports.isSoldOutEverywhere = exports.selectValue = void 0;
|
|
4
|
+
const commerceVariants_1 = require("../Commerce/commerceVariants");
|
|
5
|
+
/** Picks `valueId` on `axisId`, then drops every other pick that no sellable variant can pair with it. */
|
|
6
|
+
const selectValue = (axes, variants, selection, axisId, valueId) => {
|
|
7
|
+
const next = { ...selection, [axisId]: valueId };
|
|
8
|
+
for (const axis of axes) {
|
|
9
|
+
const pick = next[axis.id];
|
|
10
|
+
if (axis.id === axisId || pick === undefined)
|
|
11
|
+
continue;
|
|
12
|
+
if (!(0, commerceVariants_1.isOptionAvailable)(variants, next, axis.id, pick))
|
|
13
|
+
delete next[axis.id];
|
|
14
|
+
}
|
|
15
|
+
return next;
|
|
16
|
+
};
|
|
17
|
+
exports.selectValue = selectValue;
|
|
18
|
+
/** Sold out under every combination, so picking it can never lead to a purchasable variant. */
|
|
19
|
+
const isSoldOutEverywhere = (variants, axisId, valueId) => !(0, commerceVariants_1.isOptionAvailable)(variants, {}, axisId, valueId);
|
|
20
|
+
exports.isSoldOutEverywhere = isSoldOutEverywhere;
|
|
21
|
+
const sameSelection = (a, b) => {
|
|
22
|
+
const keys = new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
23
|
+
return [...keys].every((key) => a[key] === b[key]);
|
|
24
|
+
};
|
|
25
|
+
exports.sameSelection = sameSelection;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WishlistToggleProps } from "./WishlistToggleProps";
|
|
2
|
+
/** Heart toggle for saving a product: glass on media, tonal or bare elsewhere; pops once when saved. */
|
|
3
|
+
declare const WishlistToggle: ({ selected, defaultSelected, onSelectedChange, size, variant, label, isDisabled, "data-testid": testId, }: WishlistToggleProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default WishlistToggle;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_2 = require("@chakra-ui/react");
|
|
6
|
+
const react_3 = require("@emotion/react");
|
|
7
|
+
const lucide_react_1 = require("lucide-react");
|
|
8
|
+
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
9
|
+
const motion_1 = require("../../Theme/tokens/primitives/motion");
|
|
10
|
+
const controlSizes_1 = require("../../Theme/tokens/primitives/controlSizes");
|
|
11
|
+
const motion_2 = require("../../Theme/chakra/motion");
|
|
12
|
+
const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
|
|
13
|
+
const filledSurface_1 = require("../../Theme/tokens/builders/filledSurface");
|
|
14
|
+
const scrim_1 = require("../../Theme/tokens/builders/scrim");
|
|
15
|
+
const HIT_PX = { sm: 32, md: 44, lg: 48 };
|
|
16
|
+
const POP_MS = 320;
|
|
17
|
+
const pop = (0, react_3.keyframes) `
|
|
18
|
+
0% { transform: scale(1); }
|
|
19
|
+
40% { transform: scale(1.2); }
|
|
20
|
+
100% { transform: scale(1); }
|
|
21
|
+
`;
|
|
22
|
+
/** Heart toggle for saving a product: glass on media, tonal or bare elsewhere; pops once when saved. */
|
|
23
|
+
const WishlistToggle = ({ selected, defaultSelected = false, onSelectedChange, size = "md", variant = "soft", label, isDisabled = false, "data-testid": testId, }) => {
|
|
24
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
25
|
+
const reduced = (0, motion_2.usePrefersReducedMotion)();
|
|
26
|
+
const [inner, setInner] = (0, react_1.useState)(defaultSelected);
|
|
27
|
+
const [popKey, setPopKey] = (0, react_1.useState)(0);
|
|
28
|
+
const on = selected !== null && selected !== void 0 ? selected : inner;
|
|
29
|
+
const spec = controlSizes_1.BUTTON_SIZES[size];
|
|
30
|
+
const hit = HIT_PX[size];
|
|
31
|
+
const icon = spec.iconSize + 2;
|
|
32
|
+
const popping = on && popKey > 0 && !reduced;
|
|
33
|
+
const toggle = () => {
|
|
34
|
+
const next = !on;
|
|
35
|
+
if (selected === undefined)
|
|
36
|
+
setInner(next);
|
|
37
|
+
if (next)
|
|
38
|
+
setPopKey((k) => k + 1);
|
|
39
|
+
onSelectedChange === null || onSelectedChange === void 0 ? void 0 : onSelectedChange(next);
|
|
40
|
+
};
|
|
41
|
+
const saved = (0, filledSurface_1.resolveFilledSurface)(colors.semantic.error, colors);
|
|
42
|
+
const look = (() => {
|
|
43
|
+
if (variant === "glass") {
|
|
44
|
+
return on
|
|
45
|
+
? { bg: saved.fill, hoverBg: saved.hoverFill, color: saved.color }
|
|
46
|
+
: { bg: (0, scrim_1.overlayScrim)(colors), hoverBg: (0, scrim_1.overlayScrim)(colors), color: colors.white };
|
|
47
|
+
}
|
|
48
|
+
const ink = on ? colors.semanticText.error : variant === "soft" ? colors.header[900] : colors.textMuted;
|
|
49
|
+
return {
|
|
50
|
+
bg: variant === "soft" ? colors.background[100] : colors.transparent,
|
|
51
|
+
hoverBg: variant === "soft" ? colors.background[200] : colors.background[100],
|
|
52
|
+
color: ink,
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)(react_2.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: {
|
|
56
|
+
outline: "none",
|
|
57
|
+
"&:focus-visible > [data-disc]": (0, focusRing_styles_1.focusVisibleRing)(colors),
|
|
58
|
+
"&:hover:not(:disabled) > [data-disc]": { backgroundColor: look.hoverBg },
|
|
59
|
+
...(reduced ? {} : { "&:active:not(:disabled) > [data-disc]": { transform: "scale(0.92)" } }),
|
|
60
|
+
}, children: (0, jsx_runtime_1.jsx)(react_2.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: (0, motion_1.transitionFor)(["background-color", "color", "transform"]), sx: {
|
|
61
|
+
...(variant === "glass" ? { backdropFilter: "blur(8px)", WebkitBackdropFilter: "blur(8px)" } : {}),
|
|
62
|
+
...(0, motion_2.reducedMotionSx)(),
|
|
63
|
+
}, children: (0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-flex", "data-pop": popping || undefined, animation: popping ? `${pop} ${POP_MS}ms ${motion_1.MOTION_EASE}` : undefined, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Heart, { size: icon, "aria-hidden": true, fill: on ? "currentColor" : "none", strokeWidth: 2 }) }, popKey) }) }));
|
|
64
|
+
};
|
|
65
|
+
exports.default = WishlistToggle;
|