pixelize-design-library 2.4.2-beta.55 → 2.4.2-beta.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/COMPONENT-GOTCHAS.md +50 -22
- package/DESIGN-GUIDE.md +19 -2
- package/dist/Components/AddressCard/AddressCard.d.ts +4 -0
- package/dist/Components/AddressCard/AddressCard.js +25 -0
- package/dist/Components/AddressCard/AddressCardGroup.d.ts +4 -0
- package/dist/Components/AddressCard/AddressCardGroup.js +7 -0
- package/dist/Components/AddressCard/AddressCardProps.d.ts +43 -0
- package/dist/Components/AddressCard/AddressCardProps.js +2 -0
- package/dist/Components/BagBar/BagBar.d.ts +4 -0
- package/dist/Components/BagBar/BagBar.js +32 -0
- package/dist/Components/BagBar/BagBarProps.d.ts +30 -0
- package/dist/Components/BagBar/BagBarProps.js +2 -0
- package/dist/Components/CartItem/CartItem.d.ts +4 -0
- package/dist/Components/CartItem/CartItem.js +60 -0
- package/dist/Components/CartItem/CartItemProps.d.ts +64 -0
- package/dist/Components/CartItem/CartItemProps.js +2 -0
- package/dist/Components/CartItem/cartItemOptions.d.ts +3 -0
- package/dist/Components/CartItem/cartItemOptions.js +13 -0
- package/dist/Components/CheckoutKit/selectable.d.ts +58 -0
- package/dist/Components/CheckoutKit/selectable.js +120 -0
- package/dist/Components/Commerce/commerceTypes.d.ts +52 -0
- package/dist/Components/Commerce/commerceTypes.js +2 -0
- package/dist/Components/Commerce/commerceVariants.d.ts +13 -0
- package/dist/Components/Commerce/commerceVariants.js +51 -0
- package/dist/Components/Commerce/index.d.ts +2 -0
- package/dist/Components/Commerce/index.js +18 -0
- package/dist/Components/Commerce/useContainerWidth.d.ts +3 -0
- package/dist/Components/Commerce/useContainerWidth.js +25 -0
- package/dist/Components/CouponField/CouponField.d.ts +4 -0
- package/dist/Components/CouponField/CouponField.js +72 -0
- package/dist/Components/CouponField/CouponFieldProps.d.ts +49 -0
- package/dist/Components/CouponField/CouponFieldProps.js +2 -0
- package/dist/Components/DatePicker/DatePickerProps.d.ts +1 -1
- package/dist/Components/DatePicker/PickerPortal.d.ts +11 -0
- package/dist/Components/DatePicker/PickerPortal.js +26 -0
- package/dist/Components/DatePicker/RangeDatePicker.d.ts +1 -1
- package/dist/Components/DatePicker/RangeDatePicker.js +67 -32
- package/dist/Components/DatePicker/SingleDatePicker.js +49 -13
- package/dist/Components/DatePicker/TimeOnlyPicker.js +39 -4
- package/dist/Components/DetailSections/DetailSections.d.ts +4 -0
- package/dist/Components/DetailSections/DetailSections.js +112 -0
- package/dist/Components/DetailSections/DetailSectionsProps.d.ts +58 -0
- package/dist/Components/DetailSections/DetailSectionsProps.js +2 -0
- package/dist/Components/Input/PhoneNumberInputProps.d.ts +1 -1
- package/dist/Components/MediaGallery/MediaFrame.d.ts +31 -0
- package/dist/Components/MediaGallery/MediaFrame.js +55 -0
- package/dist/Components/MediaGallery/MediaGallery.d.ts +4 -0
- package/dist/Components/MediaGallery/MediaGallery.js +206 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.d.ts +76 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.js +20 -0
- package/dist/Components/MediaGallery/MediaLightbox.d.ts +4 -0
- package/dist/Components/MediaGallery/MediaLightbox.js +116 -0
- package/dist/Components/MediaGallery/MediaLightboxProps.d.ts +40 -0
- package/dist/Components/MediaGallery/MediaLightboxProps.js +15 -0
- package/dist/Components/MediaGallery/MediaThumb.d.ts +18 -0
- package/dist/Components/MediaGallery/MediaThumb.js +25 -0
- package/dist/Components/MediaGallery/glass.d.ts +31 -0
- package/dist/Components/MediaGallery/glass.js +47 -0
- package/dist/Components/MediaGallery/mediaGalleryModel.d.ts +22 -0
- package/dist/Components/MediaGallery/mediaGalleryModel.js +83 -0
- package/dist/Components/MediaGallery/motion.d.ts +5 -0
- package/dist/Components/MediaGallery/motion.js +12 -0
- package/dist/Components/MediaGallery/useMatchMedia.d.ts +2 -0
- package/dist/Components/MediaGallery/useMatchMedia.js +20 -0
- package/dist/Components/MultiSelect/MultiSelectProps.d.ts +1 -1
- package/dist/Components/OffersList/OffersList.d.ts +4 -0
- package/dist/Components/OffersList/OffersList.js +83 -0
- package/dist/Components/OffersList/OffersListProps.d.ts +34 -0
- package/dist/Components/OffersList/OffersListProps.js +2 -0
- package/dist/Components/OptionChip/OptionChip.d.ts +4 -0
- package/dist/Components/OptionChip/OptionChip.js +97 -0
- package/dist/Components/OptionChip/OptionChipProps.d.ts +33 -0
- package/dist/Components/OptionChip/OptionChipProps.js +2 -0
- package/dist/Components/OptionChip/optionInk.d.ts +12 -0
- package/dist/Components/OptionChip/optionInk.js +25 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.d.ts +4 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.js +57 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.d.ts +29 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +2 -0
- package/dist/Components/OrderSummary/OrderSummary.d.ts +4 -0
- package/dist/Components/OrderSummary/OrderSummary.js +63 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.d.ts +53 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.js +2 -0
- package/dist/Components/PaymentOption/PaymentOption.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOption.js +24 -0
- package/dist/Components/PaymentOption/PaymentOptionGroup.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOptionGroup.js +7 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.d.ts +32 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.js +2 -0
- package/dist/Components/PinInput/PinInputProps.d.ts +1 -1
- package/dist/Components/PincodeChecker/PincodeChecker.d.ts +4 -0
- package/dist/Components/PincodeChecker/PincodeChecker.js +175 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.d.ts +57 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.js +2 -0
- package/dist/Components/PriceBlock/PriceBlock.d.ts +4 -0
- package/dist/Components/PriceBlock/PriceBlock.js +41 -0
- package/dist/Components/PriceBlock/PriceBlockProps.d.ts +39 -0
- package/dist/Components/PriceBlock/PriceBlockProps.js +2 -0
- package/dist/Components/ProductBadges/ProductBadges.d.ts +4 -0
- package/dist/Components/ProductBadges/ProductBadges.js +61 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.d.ts +18 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.js +2 -0
- package/dist/Components/ProductCard/ProductCard.d.ts +3 -2
- package/dist/Components/ProductCard/ProductCard.js +103 -52
- package/dist/Components/ProductCard/ProductCardAction.d.ts +17 -0
- package/dist/Components/ProductCard/ProductCardAction.js +65 -0
- package/dist/Components/ProductCard/ProductCardGrid.d.ts +4 -0
- package/dist/Components/ProductCard/ProductCardGrid.js +20 -0
- package/dist/Components/ProductCard/ProductCardMedia.d.ts +18 -0
- package/dist/Components/ProductCard/ProductCardMedia.js +35 -0
- package/dist/Components/ProductCard/ProductCardProps.d.ts +138 -56
- package/dist/Components/ProductCard/ProductCardSkeleton.d.ts +4 -0
- package/dist/Components/ProductCard/ProductCardSkeleton.js +17 -0
- package/dist/Components/ProductCard/ProductCardSwatches.d.ts +15 -0
- package/dist/Components/ProductCard/ProductCardSwatches.js +37 -0
- package/dist/Components/ProductCard/QuickAddSheet.d.ts +4 -0
- package/dist/Components/ProductCard/QuickAddSheet.js +109 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.d.ts +38 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.js +2 -0
- package/dist/Components/ProductCard/cardLabels.d.ts +2 -0
- package/dist/Components/ProductCard/cardLabels.js +16 -0
- package/dist/Components/ProductCard/cardMetrics.d.ts +27 -0
- package/dist/Components/ProductCard/cardMetrics.js +55 -0
- package/dist/Components/ProductCard/productCardFixtures.d.ts +7 -0
- package/dist/Components/ProductCard/productCardFixtures.js +61 -0
- package/dist/Components/ProductCard/productCardModel.d.ts +22 -0
- package/dist/Components/ProductCard/productCardModel.js +79 -0
- package/dist/Components/ProductCard/useMinWidth.d.ts +2 -0
- package/dist/Components/ProductCard/useMinWidth.js +20 -0
- package/dist/Components/ProductDetails/ProductDetails.d.ts +3 -2
- package/dist/Components/ProductDetails/ProductDetails.js +209 -33
- package/dist/Components/ProductDetails/ProductDetailsProps.d.ts +143 -41
- package/dist/Components/ProductDetails/productDetailsModel.d.ts +14 -0
- package/dist/Components/ProductDetails/productDetailsModel.js +45 -0
- package/dist/Components/ProductDetails/useInViewport.d.ts +3 -0
- package/dist/Components/ProductDetails/useInViewport.js +18 -0
- package/dist/Components/QuantityStepper/QuantityStepper.d.ts +4 -0
- package/dist/Components/QuantityStepper/QuantityStepper.js +59 -0
- package/dist/Components/QuantityStepper/QuantityStepperProps.d.ts +24 -0
- package/dist/Components/QuantityStepper/QuantityStepperProps.js +2 -0
- package/dist/Components/Rating/Rating.d.ts +4 -0
- package/dist/Components/Rating/Rating.js +81 -0
- package/dist/Components/Rating/RatingProps.d.ts +27 -0
- package/dist/Components/Rating/RatingProps.js +2 -0
- package/dist/Components/ReviewList/ReviewList.d.ts +4 -0
- package/dist/Components/ReviewList/ReviewList.js +94 -0
- package/dist/Components/ReviewList/ReviewListProps.d.ts +68 -0
- package/dist/Components/ReviewList/ReviewListProps.js +2 -0
- package/dist/Components/ReviewSummary/ReviewSummary.d.ts +4 -0
- package/dist/Components/ReviewSummary/ReviewSummary.js +47 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.d.ts +31 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.js +2 -0
- package/dist/Components/Search/SearchProps.d.ts +1 -1
- package/dist/Components/SearchSelect/SearchSelectProps.d.ts +1 -1
- package/dist/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/Components/SegmentedControl/SegmentedControl.js +17 -5
- package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +6 -0
- package/dist/Components/SegmentedControl/segmentedInk.d.ts +2 -0
- package/dist/Components/SegmentedControl/segmentedInk.js +4 -1
- package/dist/Components/SegmentedControl/useSlidingPill.d.ts +2 -0
- package/dist/Components/SegmentedControl/useSlidingPill.js +6 -1
- package/dist/Components/Select/SelectProps.d.ts +1 -1
- package/dist/Components/SelectSearch/SelectSearchProps.d.ts +1 -1
- package/dist/Components/SelectV2/SelectV2Props.d.ts +1 -1
- package/dist/Components/SideBar/SecondaryBar.js +13 -8
- package/dist/Components/SideBar/SideBarProps.d.ts +3 -1
- package/dist/Components/SideBar/components/MenuItemBox.js +47 -10
- package/dist/Components/SideBar/components/MenuPopoverContent.js +4 -3
- package/dist/Components/SpecTable/SpecTable.d.ts +4 -0
- package/dist/Components/SpecTable/SpecTable.js +39 -0
- package/dist/Components/SpecTable/SpecTableProps.d.ts +25 -0
- package/dist/Components/SpecTable/SpecTableProps.js +2 -0
- package/dist/Components/Spinner/Spinner.d.ts +1 -1
- package/dist/Components/Spinner/Spinner.js +2 -2
- package/dist/Components/Spinner/SpinnerProps.d.ts +2 -0
- package/dist/Components/StageProgress/StepperStage.js +2 -1
- package/dist/Components/StatCard/StatCard.d.ts +1 -1
- package/dist/Components/StatCard/StatCard.js +2 -2
- package/dist/Components/StatCard/StatCardProps.d.ts +4 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.d.ts +3 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.js +85 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.d.ts +54 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.js +2 -0
- package/dist/Components/StockStatus/StockStatus.d.ts +4 -0
- package/dist/Components/StockStatus/StockStatus.js +31 -0
- package/dist/Components/StockStatus/StockStatusProps.d.ts +14 -0
- package/dist/Components/StockStatus/StockStatusProps.js +2 -0
- package/dist/Components/Table/Table.js +2 -1
- package/dist/Components/Table/TableProps.d.ts +5 -2
- package/dist/Components/Table/columnLabel.d.ts +6 -0
- package/dist/Components/Table/columnLabel.js +27 -0
- package/dist/Components/Table/components/TableBody.js +5 -1
- package/dist/Components/Table/components/TableHeader.js +3 -2
- package/dist/Components/Table/filters/ActiveFilters.js +2 -1
- package/dist/Components/Table/filters/TableFilters.js +2 -1
- package/dist/Components/Table/hooks/useTable.js +3 -2
- package/dist/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/Components/Table/settings/TableSettings.js +2 -1
- package/dist/Components/TrustBadges/TrustBadges.d.ts +4 -0
- package/dist/Components/TrustBadges/TrustBadges.js +24 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.d.ts +20 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.js +2 -0
- package/dist/Components/VariantSelector/VariantSelector.d.ts +4 -0
- package/dist/Components/VariantSelector/VariantSelector.js +123 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.d.ts +27 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.js +2 -0
- package/dist/Components/VariantSelector/variantSelection.d.ts +6 -0
- package/dist/Components/VariantSelector/variantSelection.js +25 -0
- package/dist/Components/WishlistToggle/WishlistToggle.d.ts +4 -0
- package/dist/Components/WishlistToggle/WishlistToggle.js +65 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.d.ts +19 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.js +2 -0
- package/dist/Theme/assertPalette.d.ts +1 -1
- package/dist/Theme/assertPalette.js +1 -1
- package/dist/Theme/tokens/brands/index.js +2 -0
- package/dist/Theme/tokens/brands/zinc/palette.dark.d.ts +1 -0
- package/dist/Theme/tokens/builders/buildDarkPalette.js +2 -0
- package/dist/Theme/tokens/builders/index.d.ts +1 -0
- package/dist/Theme/tokens/builders/index.js +1 -0
- package/dist/Theme/tokens/builders/rechartsTheme.d.ts +56 -0
- package/dist/Theme/tokens/builders/rechartsTheme.js +43 -0
- package/dist/Theme/tokens/builders/star.d.ts +3 -0
- package/dist/Theme/tokens/builders/star.js +8 -0
- package/dist/Theme/tokens/primitives/controlSizes.js +1 -1
- package/dist/Theme/tokens/types.d.ts +3 -1
- package/dist/Theme/useChartTheme.d.ts +4 -0
- package/dist/Theme/useChartTheme.js +12 -0
- package/dist/Utils/price.d.ts +16 -0
- package/dist/Utils/price.js +34 -0
- package/dist/esm/Components/AddressCard/AddressCard.js +20 -0
- package/dist/esm/Components/AddressCard/AddressCardGroup.js +5 -0
- package/dist/esm/Components/AddressCard/AddressCardProps.js +1 -0
- package/dist/esm/Components/BagBar/BagBar.js +27 -0
- package/dist/esm/Components/BagBar/BagBarProps.js +1 -0
- package/dist/esm/Components/CartItem/CartItem.js +55 -0
- package/dist/esm/Components/CartItem/CartItemProps.js +1 -0
- package/dist/esm/Components/CartItem/cartItemOptions.js +9 -0
- package/dist/esm/Components/CheckoutKit/selectable.js +112 -0
- package/dist/esm/Components/Commerce/commerceTypes.js +1 -0
- package/dist/esm/Components/Commerce/commerceVariants.js +41 -0
- package/dist/esm/Components/Commerce/index.js +2 -0
- package/dist/esm/Components/Commerce/useContainerWidth.js +21 -0
- package/dist/esm/Components/CouponField/CouponField.js +67 -0
- package/dist/esm/Components/CouponField/CouponFieldProps.js +1 -0
- package/dist/esm/Components/DatePicker/PickerPortal.js +21 -0
- package/dist/esm/Components/DatePicker/RangeDatePicker.js +34 -32
- package/dist/esm/Components/DatePicker/SingleDatePicker.js +16 -13
- package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +6 -4
- package/dist/esm/Components/DetailSections/DetailSections.js +107 -0
- package/dist/esm/Components/DetailSections/DetailSectionsProps.js +1 -0
- package/dist/esm/Components/MediaGallery/MediaFrame.js +48 -0
- package/dist/esm/Components/MediaGallery/MediaGallery.js +201 -0
- package/dist/esm/Components/MediaGallery/MediaGalleryProps.js +17 -0
- package/dist/esm/Components/MediaGallery/MediaLightbox.js +78 -0
- package/dist/esm/Components/MediaGallery/MediaLightboxProps.js +12 -0
- package/dist/esm/Components/MediaGallery/MediaThumb.js +23 -0
- package/dist/esm/Components/MediaGallery/glass.js +42 -0
- package/dist/esm/Components/MediaGallery/mediaGalleryModel.js +71 -0
- package/dist/esm/Components/MediaGallery/motion.js +8 -0
- package/dist/esm/Components/MediaGallery/useMatchMedia.js +16 -0
- package/dist/esm/Components/OffersList/OffersList.js +81 -0
- package/dist/esm/Components/OffersList/OffersListProps.js +1 -0
- package/dist/esm/Components/OptionChip/OptionChip.js +95 -0
- package/dist/esm/Components/OptionChip/OptionChipProps.js +1 -0
- package/dist/esm/Components/OptionChip/optionInk.js +21 -0
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimeline.js +55 -0
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +1 -0
- package/dist/esm/Components/OrderSummary/OrderSummary.js +58 -0
- package/dist/esm/Components/OrderSummary/OrderSummaryProps.js +1 -0
- package/dist/esm/Components/PaymentOption/PaymentOption.js +19 -0
- package/dist/esm/Components/PaymentOption/PaymentOptionGroup.js +5 -0
- package/dist/esm/Components/PaymentOption/PaymentOptionProps.js +1 -0
- package/dist/esm/Components/PincodeChecker/PincodeChecker.js +170 -0
- package/dist/esm/Components/PincodeChecker/PincodeCheckerProps.js +1 -0
- package/dist/esm/Components/PriceBlock/PriceBlock.js +39 -0
- package/dist/esm/Components/PriceBlock/PriceBlockProps.js +1 -0
- package/dist/esm/Components/ProductBadges/ProductBadges.js +59 -0
- package/dist/esm/Components/ProductBadges/ProductBadgesProps.js +1 -0
- package/dist/esm/Components/ProductCard/ProductCard.js +105 -54
- package/dist/esm/Components/ProductCard/ProductCardAction.js +60 -0
- package/dist/esm/Components/ProductCard/ProductCardGrid.js +18 -0
- package/dist/esm/Components/ProductCard/ProductCardMedia.js +33 -0
- package/dist/esm/Components/ProductCard/ProductCardSkeleton.js +12 -0
- package/dist/esm/Components/ProductCard/ProductCardSwatches.js +35 -0
- package/dist/esm/Components/ProductCard/QuickAddSheet.js +71 -0
- package/dist/esm/Components/ProductCard/QuickAddSheetProps.js +1 -0
- package/dist/esm/Components/ProductCard/cardLabels.js +13 -0
- package/dist/esm/Components/ProductCard/cardMetrics.js +52 -0
- package/dist/esm/Components/ProductCard/productCardFixtures.js +58 -0
- package/dist/esm/Components/ProductCard/productCardModel.js +65 -0
- package/dist/esm/Components/ProductCard/useMinWidth.js +16 -0
- package/dist/esm/Components/ProductDetails/ProductDetails.js +210 -34
- package/dist/esm/Components/ProductDetails/productDetailsModel.js +35 -0
- package/dist/esm/Components/ProductDetails/useInViewport.js +14 -0
- package/dist/esm/Components/QuantityStepper/QuantityStepper.js +57 -0
- package/dist/esm/Components/QuantityStepper/QuantityStepperProps.js +1 -0
- package/dist/esm/Components/Rating/Rating.js +79 -0
- package/dist/esm/Components/Rating/RatingProps.js +1 -0
- package/dist/esm/Components/ReviewList/ReviewList.js +89 -0
- package/dist/esm/Components/ReviewList/ReviewListProps.js +1 -0
- package/dist/esm/Components/ReviewSummary/ReviewSummary.js +42 -0
- package/dist/esm/Components/ReviewSummary/ReviewSummaryProps.js +1 -0
- package/dist/esm/Components/SegmentedControl/SegmentedControl.js +19 -7
- package/dist/esm/Components/SegmentedControl/segmentedInk.js +2 -0
- package/dist/esm/Components/SegmentedControl/useSlidingPill.js +6 -1
- package/dist/esm/Components/SideBar/SecondaryBar.js +14 -9
- package/dist/esm/Components/SideBar/components/MenuItemBox.js +14 -10
- package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +4 -3
- package/dist/esm/Components/SpecTable/SpecTable.js +34 -0
- package/dist/esm/Components/SpecTable/SpecTableProps.js +1 -0
- package/dist/esm/Components/Spinner/Spinner.js +2 -2
- package/dist/esm/Components/StageProgress/StepperStage.js +2 -1
- package/dist/esm/Components/StatCard/StatCard.js +2 -2
- package/dist/esm/Components/StickyBuyBar/StickyBuyBar.js +80 -0
- package/dist/esm/Components/StickyBuyBar/StickyBuyBarProps.js +1 -0
- package/dist/esm/Components/StockStatus/StockStatus.js +29 -0
- package/dist/esm/Components/StockStatus/StockStatusProps.js +1 -0
- package/dist/esm/Components/Table/Table.js +2 -1
- package/dist/esm/Components/Table/columnLabel.js +21 -0
- package/dist/esm/Components/Table/components/TableBody.js +5 -1
- package/dist/esm/Components/Table/components/TableHeader.js +3 -2
- package/dist/esm/Components/Table/filters/ActiveFilters.js +2 -1
- package/dist/esm/Components/Table/filters/TableFilters.js +2 -1
- package/dist/esm/Components/Table/hooks/useTable.js +3 -2
- package/dist/esm/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/esm/Components/Table/settings/TableSettings.js +2 -1
- package/dist/esm/Components/TrustBadges/TrustBadges.js +22 -0
- package/dist/esm/Components/TrustBadges/TrustBadgesProps.js +1 -0
- package/dist/esm/Components/VariantSelector/VariantSelector.js +118 -0
- package/dist/esm/Components/VariantSelector/VariantSelectorProps.js +1 -0
- package/dist/esm/Components/VariantSelector/variantSelection.js +19 -0
- package/dist/esm/Components/WishlistToggle/WishlistToggle.js +63 -0
- package/dist/esm/Components/WishlistToggle/WishlistToggleProps.js +1 -0
- package/dist/esm/Theme/assertPalette.js +1 -1
- package/dist/esm/Theme/tokens/brands/index.js +2 -0
- package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +2 -0
- package/dist/esm/Theme/tokens/builders/index.js +1 -0
- package/dist/esm/Theme/tokens/builders/rechartsTheme.js +37 -0
- package/dist/esm/Theme/tokens/builders/star.js +4 -0
- package/dist/esm/Theme/tokens/primitives/controlSizes.js +1 -1
- package/dist/esm/Theme/useChartTheme.js +8 -0
- package/dist/esm/Utils/price.js +27 -0
- package/dist/esm/index.js +36 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +86 -4
- package/package.json +1 -1
- package/dist/Components/ProductCard/ProductLabel.d.ts +0 -7
- package/dist/Components/ProductCard/ProductLabel.js +0 -20
- package/dist/Components/ProductCard/ProductPrice.d.ts +0 -10
- package/dist/Components/ProductCard/ProductPrice.js +0 -126
- package/dist/Components/ProductCard/ProductReview.d.ts +0 -8
- package/dist/Components/ProductCard/ProductReview.js +0 -30
- package/dist/Components/ProductCard/ProductTags.d.ts +0 -8
- package/dist/Components/ProductCard/ProductTags.js +0 -53
- package/dist/Components/ProductDetails/ProductDtlPrice.d.ts +0 -7
- package/dist/Components/ProductDetails/ProductDtlPrice.js +0 -24
- package/dist/Components/ProductDetails/ProductImageSlider.d.ts +0 -13
- package/dist/Components/ProductDetails/ProductImageSlider.js +0 -240
- package/dist/esm/Components/ProductCard/ProductLabel.js +0 -18
- package/dist/esm/Components/ProductCard/ProductPrice.js +0 -121
- package/dist/esm/Components/ProductCard/ProductReview.js +0 -28
- package/dist/esm/Components/ProductCard/ProductTags.js +0 -48
- package/dist/esm/Components/ProductDetails/ProductDtlPrice.js +0 -22
- package/dist/esm/Components/ProductDetails/ProductImageSlider.js +0 -204
|
@@ -0,0 +1,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]),
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import radii from "../primitives/radii.js";
|
|
2
|
+
import { chartInk, getCategoricalSeriesColors } from "./chartColorsFromTheme.js";
|
|
3
|
+
const FONT = "inherit";
|
|
4
|
+
const FONT_SIZE = "12px";
|
|
5
|
+
const DASH = "4 4";
|
|
6
|
+
// Reuses chartInk/getCategoricalSeriesColors — no parallel color derivation. No recharts import.
|
|
7
|
+
export function buildRechartsTheme(colors) {
|
|
8
|
+
const ink = chartInk(colors);
|
|
9
|
+
return {
|
|
10
|
+
seriesColors: getCategoricalSeriesColors(colors),
|
|
11
|
+
grid: { stroke: ink.grid, strokeDasharray: DASH },
|
|
12
|
+
axis: {
|
|
13
|
+
stroke: ink.grid,
|
|
14
|
+
tick: { fill: ink.axis, fontSize: FONT_SIZE, fontFamily: FONT },
|
|
15
|
+
},
|
|
16
|
+
tooltip: {
|
|
17
|
+
contentStyle: {
|
|
18
|
+
backgroundColor: ink.tooltipBg,
|
|
19
|
+
border: `1px solid ${ink.grid}`,
|
|
20
|
+
borderRadius: radii.md,
|
|
21
|
+
color: ink.text,
|
|
22
|
+
fontSize: FONT_SIZE,
|
|
23
|
+
fontFamily: FONT,
|
|
24
|
+
},
|
|
25
|
+
labelStyle: { color: ink.text, fontWeight: 600 },
|
|
26
|
+
itemStyle: { color: ink.text },
|
|
27
|
+
cursor: { stroke: ink.grid, strokeDasharray: DASH },
|
|
28
|
+
},
|
|
29
|
+
legend: {
|
|
30
|
+
wrapperStyle: { color: ink.muted, fontSize: FONT_SIZE, fontFamily: FONT },
|
|
31
|
+
},
|
|
32
|
+
referenceLine: { stroke: ink.muted, strokeDasharray: DASH },
|
|
33
|
+
surface: ink.surface,
|
|
34
|
+
text: ink.text,
|
|
35
|
+
muted: ink.muted,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Height scale for form fields and selects — text inputs, pickers, anything typed or picked into. */
|
|
2
2
|
export const CONTROL_SIZES = {
|
|
3
|
-
xs: { height: "
|
|
3
|
+
xs: { height: "2rem", fontSize: "0.75rem", paddingX: "0.5rem", iconSize: 12 },
|
|
4
4
|
sm: { height: "2.375rem", fontSize: "0.8125rem", paddingX: "0.75rem", iconSize: 14 },
|
|
5
5
|
md: { height: "2.5rem", fontSize: "0.875rem", paddingX: "1rem", iconSize: 16 },
|
|
6
6
|
lg: { height: "3rem", fontSize: "1rem", paddingX: "1.5rem", iconSize: 18 },
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useCustomTheme } from "./useCustomTheme.js";
|
|
3
|
+
import { buildRechartsTheme } from "./tokens/builders/rechartsTheme.js";
|
|
4
|
+
export const useChartTheme = () => {
|
|
5
|
+
const { colors } = useCustomTheme();
|
|
6
|
+
return useMemo(() => buildRechartsTheme(colors), [colors]);
|
|
7
|
+
};
|
|
8
|
+
export default useChartTheme;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const DEFAULT_CURRENCY = "INR";
|
|
2
|
+
export const DEFAULT_LOCALE = "en-IN";
|
|
3
|
+
export function formatPrice(value, options = {}) {
|
|
4
|
+
const { currency = DEFAULT_CURRENCY, locale = DEFAULT_LOCALE, maximumFractionDigits } = options;
|
|
5
|
+
const whole = Number.isInteger(value);
|
|
6
|
+
return new Intl.NumberFormat(locale, {
|
|
7
|
+
style: "currency",
|
|
8
|
+
currency,
|
|
9
|
+
minimumFractionDigits: whole ? 0 : 2,
|
|
10
|
+
maximumFractionDigits: maximumFractionDigits !== null && maximumFractionDigits !== void 0 ? maximumFractionDigits : (whole ? 0 : 2),
|
|
11
|
+
}).format(value);
|
|
12
|
+
}
|
|
13
|
+
export function discountPercent(price, mrp) {
|
|
14
|
+
if (mrp === undefined || mrp <= price || mrp <= 0)
|
|
15
|
+
return 0;
|
|
16
|
+
return Math.round(((mrp - price) / mrp) * 100);
|
|
17
|
+
}
|
|
18
|
+
export function discountAmount(price, mrp) {
|
|
19
|
+
if (mrp === undefined || mrp <= price)
|
|
20
|
+
return 0;
|
|
21
|
+
return mrp - price;
|
|
22
|
+
}
|
|
23
|
+
export function unitPrice(price, quantity, unit, per = 1) {
|
|
24
|
+
if (!(quantity > 0))
|
|
25
|
+
return null;
|
|
26
|
+
return { value: Math.round((price / quantity) * per * 100) / 100, per, unit };
|
|
27
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -143,6 +143,7 @@ export { rafThrottle } from "./Utils/rafThrottle.js";
|
|
|
143
143
|
export { toWords } from "./Utils/functions.js";
|
|
144
144
|
export { useDebouncedCallback, useDebouncedValue } from "./Hooks/useDebounce.js";
|
|
145
145
|
export { CATEGORICAL_SERIES, chartAxisLabelColor, chartInk, chartMode, getCategoricalSeriesColors, getDefaultSeriesColors, labelOnSeries, } from "./Theme/tokens/builders/chartColorsFromTheme.js";
|
|
146
|
+
export { useChartTheme } from "./Theme/useChartTheme.js";
|
|
146
147
|
// WCAG contrast + accent-picking helpers this library uses internally to keep text readable
|
|
147
148
|
// against any canvas/fill a palette produces. Pure and dependency-free — consumers building
|
|
148
149
|
// custom components against `ColorScale`/`PaletteProps` tokens can reuse the same logic instead
|
|
@@ -225,4 +226,39 @@ export { defaultMediaAudioPlayerLabels } from "./Components/MediaViewer/componen
|
|
|
225
226
|
export { default as MediaScrubber } from "./Components/MediaViewer/components/MediaScrubber.js";
|
|
226
227
|
export { default as MediaStatusPanel } from "./Components/MediaViewer/components/MediaStatusPanel.js";
|
|
227
228
|
export { buildMediaItems, buildFileItems, planPreview, countMedia, fileKind, resolveMediaUrl, MIN_ZOOM, MAX_ZOOM, ZOOM_STEP, PLAYBACK_SPEEDS, SEEK_STEP_SECONDS, } from "./Components/MediaViewer/mediaItems.js";
|
|
229
|
+
// Commerce
|
|
230
|
+
export { default as Rating } from "./Components/Rating/Rating.js";
|
|
231
|
+
export { default as PriceBlock } from "./Components/PriceBlock/PriceBlock.js";
|
|
232
|
+
export { default as StockStatus } from "./Components/StockStatus/StockStatus.js";
|
|
233
|
+
export { default as ProductBadges } from "./Components/ProductBadges/ProductBadges.js";
|
|
234
|
+
export { default as WishlistToggle } from "./Components/WishlistToggle/WishlistToggle.js";
|
|
235
|
+
export { default as OptionChip } from "./Components/OptionChip/OptionChip.js";
|
|
236
|
+
export { default as VariantSelector } from "./Components/VariantSelector/VariantSelector.js";
|
|
237
|
+
export { default as QuantityStepper } from "./Components/QuantityStepper/QuantityStepper.js";
|
|
238
|
+
export { default as CartItem } from "./Components/CartItem/CartItem.js";
|
|
239
|
+
export { default as OrderSummary } from "./Components/OrderSummary/OrderSummary.js";
|
|
240
|
+
export { default as CouponField } from "./Components/CouponField/CouponField.js";
|
|
241
|
+
export { default as OrderStatusTimeline } from "./Components/OrderStatusTimeline/OrderStatusTimeline.js";
|
|
242
|
+
export { default as BagBar } from "./Components/BagBar/BagBar.js";
|
|
243
|
+
export { default as StickyBuyBar } from "./Components/StickyBuyBar/StickyBuyBar.js";
|
|
244
|
+
export { default as PincodeChecker } from "./Components/PincodeChecker/PincodeChecker.js";
|
|
245
|
+
export { default as TrustBadges } from "./Components/TrustBadges/TrustBadges.js";
|
|
246
|
+
export { default as OffersList } from "./Components/OffersList/OffersList.js";
|
|
247
|
+
export { default as SpecTable } from "./Components/SpecTable/SpecTable.js";
|
|
248
|
+
export { default as ReviewSummary } from "./Components/ReviewSummary/ReviewSummary.js";
|
|
249
|
+
export { default as ReviewList } from "./Components/ReviewList/ReviewList.js";
|
|
250
|
+
export { default as DetailSections } from "./Components/DetailSections/DetailSections.js";
|
|
251
|
+
export { default as AddressCard } from "./Components/AddressCard/AddressCard.js";
|
|
252
|
+
export { default as AddressCardGroup } from "./Components/AddressCard/AddressCardGroup.js";
|
|
253
|
+
export { default as PaymentOption } from "./Components/PaymentOption/PaymentOption.js";
|
|
254
|
+
export { default as PaymentOptionGroup } from "./Components/PaymentOption/PaymentOptionGroup.js";
|
|
255
|
+
export { default as MediaGallery } from "./Components/MediaGallery/MediaGallery.js";
|
|
256
|
+
export { default as MediaLightbox } from "./Components/MediaGallery/MediaLightbox.js";
|
|
257
|
+
export { defaultMediaGalleryLabels } from "./Components/MediaGallery/MediaGalleryProps.js";
|
|
258
|
+
export { defaultMediaLightboxLabels } from "./Components/MediaGallery/MediaLightboxProps.js";
|
|
259
|
+
export { LOW_STOCK_THRESHOLD, stockState, selectionComplete, findVariant, isOptionAvailable, remainingStock, priceRange, firstAvailableSelection } from "./Components/Commerce/commerceVariants.js";
|
|
260
|
+
export { formatPrice, discountPercent, discountAmount, unitPrice } from "./Utils/price.js";
|
|
261
|
+
export { default as ProductCardGrid } from "./Components/ProductCard/ProductCardGrid.js";
|
|
262
|
+
export { default as ProductCardSkeleton } from "./Components/ProductCard/ProductCardSkeleton.js";
|
|
263
|
+
export { default as QuickAddSheet } from "./Components/ProductCard/QuickAddSheet.js";
|
|
228
264
|
export * from "./Components/Primitives/Primitives.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -127,6 +127,8 @@ export { toWords } from "./Utils/functions";
|
|
|
127
127
|
export { useDebouncedCallback, useDebouncedValue } from "./Hooks/useDebounce";
|
|
128
128
|
export { CATEGORICAL_SERIES, chartAxisLabelColor, chartInk, chartMode, getCategoricalSeriesColors, getDefaultSeriesColors, labelOnSeries, } from "./Theme/tokens/builders/chartColorsFromTheme";
|
|
129
129
|
export type { ChartMode } from "./Theme/tokens/builders/chartColorsFromTheme";
|
|
130
|
+
export { useChartTheme } from "./Theme/useChartTheme";
|
|
131
|
+
export type { RechartsAxisTheme, RechartsChartTheme, RechartsGridTheme, RechartsLegendTheme, RechartsTooltipTheme, } from "./Theme/useChartTheme";
|
|
130
132
|
export type { ColorMode, ResolvedColorMode, ThemeName, PaletteProps, ColorScale, BrandScale, SemanticColors, NamedSurfaces, FocusRingTokens, } from "./Theme/tokens/types";
|
|
131
133
|
export { statusGradient, inkSafeGradient, chipFill, chipBorder, ACCENT_GRADIENT, STATUS_INK, } from "./Components/PlanPill/planPillGradient";
|
|
132
134
|
export { isDarkCanvas, onFilled, onGradient, accentTextOnCanvas, pickAccentText, AA_NORMAL_TEXT, DARK_CANVAS_LUMINANCE, } from "./Theme/tokens/builders/accentText";
|
|
@@ -287,4 +289,68 @@ export { default as MediaStatusPanel } from "./Components/MediaViewer/components
|
|
|
287
289
|
export type { MediaStatusPanelProps, MediaStatusTone } from "./Components/MediaViewer/components/MediaStatusPanelProps";
|
|
288
290
|
export { buildMediaItems, buildFileItems, planPreview, countMedia, fileKind, resolveMediaUrl, MIN_ZOOM, MAX_ZOOM, ZOOM_STEP, PLAYBACK_SPEEDS, SEEK_STEP_SECONDS, } from "./Components/MediaViewer/mediaItems";
|
|
289
291
|
export type { MediaItem, MediaKind, FileKind, MediaSource, MediaSources, MediaFile, ViewerFile, ResolveUrl, } from "./Components/MediaViewer/mediaItems";
|
|
292
|
+
export { default as Rating } from "./Components/Rating/Rating";
|
|
293
|
+
export type { RatingProps, RatingSize } from "./Components/Rating/RatingProps";
|
|
294
|
+
export { default as PriceBlock } from "./Components/PriceBlock/PriceBlock";
|
|
295
|
+
export type { PriceBlockProps, PriceBlockSize, PriceBlockAlign, PriceBlockLabels } from "./Components/PriceBlock/PriceBlockProps";
|
|
296
|
+
export { default as StockStatus } from "./Components/StockStatus/StockStatus";
|
|
297
|
+
export type { StockStatusProps, StockStatusSize } from "./Components/StockStatus/StockStatusProps";
|
|
298
|
+
export { default as ProductBadges } from "./Components/ProductBadges/ProductBadges";
|
|
299
|
+
export type { ProductBadgesProps, ProductBadgeSize, ProductBadgeVariant, ProductBadgesOrientation } from "./Components/ProductBadges/ProductBadgesProps";
|
|
300
|
+
export { default as WishlistToggle } from "./Components/WishlistToggle/WishlistToggle";
|
|
301
|
+
export type { WishlistToggleProps, WishlistToggleSize, WishlistToggleVariant } from "./Components/WishlistToggle/WishlistToggleProps";
|
|
302
|
+
export { default as OptionChip } from "./Components/OptionChip/OptionChip";
|
|
303
|
+
export type { OptionChipProps, OptionChipVariant, OptionChipSize } from "./Components/OptionChip/OptionChipProps";
|
|
304
|
+
export { default as VariantSelector } from "./Components/VariantSelector/VariantSelector";
|
|
305
|
+
export type { VariantSelectorProps, VariantSelectorLayout } from "./Components/VariantSelector/VariantSelectorProps";
|
|
306
|
+
export { default as QuantityStepper } from "./Components/QuantityStepper/QuantityStepper";
|
|
307
|
+
export type { QuantityStepperProps, QuantityStepperSize, QuantityStepperVariant } from "./Components/QuantityStepper/QuantityStepperProps";
|
|
308
|
+
export { default as CartItem } from "./Components/CartItem/CartItem";
|
|
309
|
+
export type { CartItemProps, CartItemLayout, CartItemLabels } from "./Components/CartItem/CartItemProps";
|
|
310
|
+
export { default as OrderSummary } from "./Components/OrderSummary/OrderSummary";
|
|
311
|
+
export type { OrderSummaryProps, OrderSummaryTone, OrderSummaryLine, FreeShippingProgress, OrderSummaryLabels } from "./Components/OrderSummary/OrderSummaryProps";
|
|
312
|
+
export { default as CouponField } from "./Components/CouponField/CouponField";
|
|
313
|
+
export type { CouponFieldProps, CouponStatus, CouponSuggestion, CouponFieldLabels } from "./Components/CouponField/CouponFieldProps";
|
|
314
|
+
export { default as OrderStatusTimeline } from "./Components/OrderStatusTimeline/OrderStatusTimeline";
|
|
315
|
+
export type { OrderStatusTimelineProps, OrderStepState, OrderStatusStep, OrderStatusOrientation, OrderStatusTimelineLabels } from "./Components/OrderStatusTimeline/OrderStatusTimelineProps";
|
|
316
|
+
export { default as BagBar } from "./Components/BagBar/BagBar";
|
|
317
|
+
export type { BagBarProps, BagBarPosition, BagBarLabels } from "./Components/BagBar/BagBarProps";
|
|
318
|
+
export { default as StickyBuyBar } from "./Components/StickyBuyBar/StickyBuyBar";
|
|
319
|
+
export type { StickyBuyBarProps, StickyBuyBarMode, StickyBuyBarPosition, StickyBuyBarLabels } from "./Components/StickyBuyBar/StickyBuyBarProps";
|
|
320
|
+
export { default as PincodeChecker } from "./Components/PincodeChecker/PincodeChecker";
|
|
321
|
+
export type { PincodeCheckerProps, PincodeStatus, PincodeResult, PincodeCheckerLabels } from "./Components/PincodeChecker/PincodeCheckerProps";
|
|
322
|
+
export { default as TrustBadges } from "./Components/TrustBadges/TrustBadges";
|
|
323
|
+
export type { TrustBadgesProps, TrustItem, TrustBadgesLayout } from "./Components/TrustBadges/TrustBadgesProps";
|
|
324
|
+
export { default as OffersList } from "./Components/OffersList/OffersList";
|
|
325
|
+
export type { OffersListProps, Offer, OffersListLabels } from "./Components/OffersList/OffersListProps";
|
|
326
|
+
export { default as SpecTable } from "./Components/SpecTable/SpecTable";
|
|
327
|
+
export type { SpecTableProps, SpecItem, SpecTableLabels } from "./Components/SpecTable/SpecTableProps";
|
|
328
|
+
export { default as ReviewSummary } from "./Components/ReviewSummary/ReviewSummary";
|
|
329
|
+
export type { ReviewSummaryProps, RatingBreakdown, ReviewSummaryLabels } from "./Components/ReviewSummary/ReviewSummaryProps";
|
|
330
|
+
export { default as ReviewList } from "./Components/ReviewList/ReviewList";
|
|
331
|
+
export type { ReviewListProps, ReviewMedia, ReviewItem, ReviewListLabels } from "./Components/ReviewList/ReviewListProps";
|
|
332
|
+
export { default as DetailSections } from "./Components/DetailSections/DetailSections";
|
|
333
|
+
export type { DetailSectionsProps, DetailSection, LegalInfo, DetailSectionsLabels, DetailSectionsLayout } from "./Components/DetailSections/DetailSectionsProps";
|
|
334
|
+
export { default as AddressCard } from "./Components/AddressCard/AddressCard";
|
|
335
|
+
export { default as AddressCardGroup } from "./Components/AddressCard/AddressCardGroup";
|
|
336
|
+
export type { AddressCardProps, AddressCardGroupProps, AddressCardLabels } from "./Components/AddressCard/AddressCardProps";
|
|
337
|
+
export { default as PaymentOption } from "./Components/PaymentOption/PaymentOption";
|
|
338
|
+
export { default as PaymentOptionGroup } from "./Components/PaymentOption/PaymentOptionGroup";
|
|
339
|
+
export type { PaymentOptionProps, PaymentOptionGroupProps } from "./Components/PaymentOption/PaymentOptionProps";
|
|
340
|
+
export { default as MediaGallery } from "./Components/MediaGallery/MediaGallery";
|
|
341
|
+
export { default as MediaLightbox } from "./Components/MediaGallery/MediaLightbox";
|
|
342
|
+
export { defaultMediaGalleryLabels } from "./Components/MediaGallery/MediaGalleryProps";
|
|
343
|
+
export { defaultMediaLightboxLabels } from "./Components/MediaGallery/MediaLightboxProps";
|
|
344
|
+
export type { MediaGalleryProps, MediaGalleryLabels, MediaGalleryLayout, MediaGalleryZoom, MediaAspectRatio } from "./Components/MediaGallery/MediaGalleryProps";
|
|
345
|
+
export type { MediaLightboxProps, MediaLightboxLabels } from "./Components/MediaGallery/MediaLightboxProps";
|
|
346
|
+
export type { ProductDetailsProps, ProductDetailsProduct, ProductDetailsLabels, ProductDetailsLayout } from "./Components/ProductDetails/ProductDetailsProps";
|
|
347
|
+
export { LOW_STOCK_THRESHOLD, stockState, selectionComplete, findVariant, isOptionAvailable, remainingStock, priceRange, firstAvailableSelection } from "./Components/Commerce/commerceVariants";
|
|
348
|
+
export type { ProductMedia, ProductBadgeTone, ProductBadge, OptionAxisType, OptionValue, OptionAxis, VariantSelection, ProductVariant, StockState, PriceFormat } from "./Components/Commerce/commerceTypes";
|
|
349
|
+
export { formatPrice, discountPercent, discountAmount, unitPrice } from "./Utils/price";
|
|
350
|
+
export type { PriceFormatOptions, UnitPrice } from "./Utils/price";
|
|
351
|
+
export { default as ProductCardGrid } from "./Components/ProductCard/ProductCardGrid";
|
|
352
|
+
export { default as ProductCardSkeleton } from "./Components/ProductCard/ProductCardSkeleton";
|
|
353
|
+
export { default as QuickAddSheet } from "./Components/ProductCard/QuickAddSheet";
|
|
354
|
+
export type { ProductCardProps, ProductCardLayout, ProductCardDensity, ProductCardAspectRatio, ProductCardAction, ProductCardLabels, ProductCardPressHandler, ProductCardSkeletonProps, ProductCardGridProps, ProductCardGridColumns } from "./Components/ProductCard/ProductCardProps";
|
|
355
|
+
export type { QuickAddSheetProps, QuickAddSheetLabels, QuickAddPresentation } from "./Components/ProductCard/QuickAddSheetProps";
|
|
290
356
|
export * from "./Components/Primitives/Primitives";
|