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,58 @@
|
|
|
1
|
+
import type { FocusEvent, KeyboardEvent, ReactNode } from "react";
|
|
2
|
+
import type { BoxProps } from "@chakra-ui/react";
|
|
3
|
+
import type { PaletteProps } from "../../Theme/tokens/types";
|
|
4
|
+
type GroupState = {
|
|
5
|
+
value: string | undefined;
|
|
6
|
+
tabStop: string | undefined;
|
|
7
|
+
select: (value: string) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const useSelectableGroup: () => GroupState | null;
|
|
10
|
+
export type SelectableGroupProps = {
|
|
11
|
+
value?: string;
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
onValueChange?: (value: string) => void;
|
|
14
|
+
gap?: number;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
"aria-label"?: string;
|
|
17
|
+
"aria-labelledby"?: string;
|
|
18
|
+
"data-testid"?: string;
|
|
19
|
+
};
|
|
20
|
+
/** Radiogroup with a roving tab stop; arrows move focus and selection together, like native radios. */
|
|
21
|
+
export declare const SelectableGroup: ({ value, defaultValue, onValueChange, gap, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "data-testid": testId, }: SelectableGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
/** Tonal card surface; selection is a 2px ink ring plus a check, never colour alone. */
|
|
23
|
+
export declare const selectableSurface: (colors: PaletteProps, { selected, disabled, interactive, ringed }: {
|
|
24
|
+
selected: boolean;
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
interactive: boolean;
|
|
27
|
+
ringed: boolean;
|
|
28
|
+
}) => BoxProps;
|
|
29
|
+
type RadioIndicatorProps = {
|
|
30
|
+
selected: boolean;
|
|
31
|
+
};
|
|
32
|
+
/** The 20px circle that carries selection state beside the text. */
|
|
33
|
+
export declare const RadioIndicator: ({ selected }: RadioIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export type SelectableSemantics = {
|
|
35
|
+
role: "radio" | "button" | undefined;
|
|
36
|
+
"aria-checked"?: boolean;
|
|
37
|
+
"aria-pressed"?: boolean;
|
|
38
|
+
tabIndex: number | undefined;
|
|
39
|
+
"data-value"?: string;
|
|
40
|
+
onClick: () => void;
|
|
41
|
+
onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
42
|
+
onFocus: (event: FocusEvent<HTMLElement>) => void;
|
|
43
|
+
onBlur: () => void;
|
|
44
|
+
};
|
|
45
|
+
/** Radio inside a group, toggle button when only `onSelect` is given, inert otherwise. */
|
|
46
|
+
export declare const useSelectable: ({ value, selected, disabled, onSelect, }: {
|
|
47
|
+
value?: string;
|
|
48
|
+
selected?: boolean;
|
|
49
|
+
disabled: boolean;
|
|
50
|
+
onSelect?: () => void;
|
|
51
|
+
}) => {
|
|
52
|
+
isSelected: boolean;
|
|
53
|
+
interactive: boolean;
|
|
54
|
+
inGroup: boolean;
|
|
55
|
+
ringed: boolean;
|
|
56
|
+
props: SelectableSemantics;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSelectable = exports.RadioIndicator = exports.selectableSurface = exports.SelectableGroup = exports.useSelectableGroup = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_2 = require("@chakra-ui/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 motion_2 = require("../../Theme/chakra/motion");
|
|
11
|
+
const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
|
|
12
|
+
const accentText_1 = require("../../Theme/tokens/builders/accentText");
|
|
13
|
+
const GroupContext = (0, react_1.createContext)(null);
|
|
14
|
+
const useSelectableGroup = () => (0, react_1.useContext)(GroupContext);
|
|
15
|
+
exports.useSelectableGroup = useSelectableGroup;
|
|
16
|
+
const firstEnabledValue = (children) => {
|
|
17
|
+
for (const child of react_1.Children.toArray(children)) {
|
|
18
|
+
if (!(0, react_1.isValidElement)(child))
|
|
19
|
+
continue;
|
|
20
|
+
const { value, disabled } = child.props;
|
|
21
|
+
if (typeof value === "string" && !disabled)
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
};
|
|
26
|
+
const STEP = { ArrowDown: 1, ArrowRight: 1, ArrowUp: -1, ArrowLeft: -1 };
|
|
27
|
+
/** Radiogroup with a roving tab stop; arrows move focus and selection together, like native radios. */
|
|
28
|
+
const SelectableGroup = ({ value, defaultValue, onValueChange, gap = 3, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "data-testid": testId, }) => {
|
|
29
|
+
const [inner, setInner] = (0, react_1.useState)(defaultValue);
|
|
30
|
+
const current = value !== null && value !== void 0 ? value : inner;
|
|
31
|
+
const state = (0, react_1.useMemo)(() => ({
|
|
32
|
+
value: current,
|
|
33
|
+
tabStop: current !== null && current !== void 0 ? current : firstEnabledValue(children),
|
|
34
|
+
select: (next) => {
|
|
35
|
+
if (value === undefined)
|
|
36
|
+
setInner(next);
|
|
37
|
+
if (next !== current)
|
|
38
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(next);
|
|
39
|
+
},
|
|
40
|
+
}), [current, children, value, onValueChange]);
|
|
41
|
+
const onKeyDown = (event) => {
|
|
42
|
+
const edge = event.key === "Home" ? 0 : event.key === "End" ? -1 : null;
|
|
43
|
+
const step = STEP[event.key];
|
|
44
|
+
if (edge === null && step === undefined)
|
|
45
|
+
return;
|
|
46
|
+
const radios = Array.from(event.currentTarget.querySelectorAll('[role="radio"]:not([aria-disabled="true"])'));
|
|
47
|
+
const at = radios.indexOf(document.activeElement);
|
|
48
|
+
if (at < 0)
|
|
49
|
+
return;
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
const index = edge === null ? (at + step + radios.length) % radios.length : edge < 0 ? radios.length - 1 : 0;
|
|
52
|
+
const target = radios[index];
|
|
53
|
+
target.focus();
|
|
54
|
+
const next = target.getAttribute("data-value");
|
|
55
|
+
if (next !== null)
|
|
56
|
+
state.select(next);
|
|
57
|
+
};
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(GroupContext.Provider, { value: state, children: (0, jsx_runtime_1.jsx)(react_2.Flex, { role: "radiogroup", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, direction: "column", gap: gap, onKeyDown: onKeyDown, "data-testid": testId, children: children }) }));
|
|
59
|
+
};
|
|
60
|
+
exports.SelectableGroup = SelectableGroup;
|
|
61
|
+
/** Tonal card surface; selection is a 2px ink ring plus a check, never colour alone. */
|
|
62
|
+
const selectableSurface = (colors, { selected, disabled, interactive, ringed }) => ({
|
|
63
|
+
bg: colors.background[100],
|
|
64
|
+
borderRadius: "1rem",
|
|
65
|
+
boxShadow: selected ? `inset 0 0 0 2px ${colors.header[900]}` : "none",
|
|
66
|
+
opacity: disabled ? 0.6 : 1,
|
|
67
|
+
transition: (0, motion_1.transitionFor)(["background-color", "box-shadow"]),
|
|
68
|
+
_hover: interactive && !selected && !disabled ? { bg: colors.background[200] } : undefined,
|
|
69
|
+
sx: { ...(ringed ? (0, focusRing_styles_1.focusVisibleRing)(colors) : {}), ...(0, motion_2.reducedMotionSx)() },
|
|
70
|
+
});
|
|
71
|
+
exports.selectableSurface = selectableSurface;
|
|
72
|
+
/** The 20px circle that carries selection state beside the text. */
|
|
73
|
+
const RadioIndicator = ({ selected }) => {
|
|
74
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
75
|
+
const fill = colors.header[900];
|
|
76
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", "aria-hidden": true, display: "inline-flex", alignItems: "center", justifyContent: "center", boxSize: "1.25rem", flexShrink: 0, borderRadius: "full", bg: selected ? fill : "transparent", color: (0, accentText_1.onFilled)(fill, colors.white, colors.black), boxShadow: selected ? "none" : `inset 0 0 0 1.5px ${colors.textMuted}`, transition: (0, motion_1.transitionFor)(["background-color", "box-shadow"]), sx: (0, motion_2.reducedMotionSx)(), children: selected && (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { size: 12, strokeWidth: 3 }) }));
|
|
77
|
+
};
|
|
78
|
+
exports.RadioIndicator = RadioIndicator;
|
|
79
|
+
/** Radio inside a group, toggle button when only `onSelect` is given, inert otherwise. */
|
|
80
|
+
const useSelectable = ({ value, selected, disabled, onSelect, }) => {
|
|
81
|
+
const group = (0, exports.useSelectableGroup)();
|
|
82
|
+
const [ringed, setRinged] = (0, react_1.useState)(false);
|
|
83
|
+
const inGroup = group !== null && value !== undefined;
|
|
84
|
+
const isSelected = inGroup ? group.value === value : !!selected;
|
|
85
|
+
const interactive = (inGroup || !!onSelect) && !disabled;
|
|
86
|
+
const choose = () => {
|
|
87
|
+
if (!interactive)
|
|
88
|
+
return;
|
|
89
|
+
if (inGroup)
|
|
90
|
+
group.select(value);
|
|
91
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
|
92
|
+
};
|
|
93
|
+
const props = {
|
|
94
|
+
role: inGroup ? "radio" : onSelect ? "button" : undefined,
|
|
95
|
+
"aria-checked": inGroup ? isSelected : undefined,
|
|
96
|
+
"aria-pressed": !inGroup && onSelect ? isSelected : undefined,
|
|
97
|
+
tabIndex: inGroup ? (group.tabStop === value && !disabled ? 0 : -1) : onSelect && !disabled ? 0 : undefined,
|
|
98
|
+
"data-value": inGroup ? value : undefined,
|
|
99
|
+
onClick: choose,
|
|
100
|
+
onKeyDown: (event) => {
|
|
101
|
+
if (event.target !== event.currentTarget)
|
|
102
|
+
return;
|
|
103
|
+
if (event.key === " " || event.key === "Enter") {
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
choose();
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
onFocus: (event) => {
|
|
109
|
+
try {
|
|
110
|
+
setRinged(event.currentTarget.matches(":focus-visible"));
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
setRinged(true);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
onBlur: () => setRinged(false),
|
|
117
|
+
};
|
|
118
|
+
return { isSelected, interactive, inGroup, ringed, props };
|
|
119
|
+
};
|
|
120
|
+
exports.useSelectable = useSelectable;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type ProductMedia = {
|
|
2
|
+
id: string;
|
|
3
|
+
src: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
thumb?: string;
|
|
6
|
+
type?: "image" | "video";
|
|
7
|
+
poster?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ProductBadgeTone = "accent" | "neutral" | "success" | "warning" | "danger" | "info" | "inverse";
|
|
10
|
+
export type ProductBadge = {
|
|
11
|
+
label: string;
|
|
12
|
+
tone?: ProductBadgeTone;
|
|
13
|
+
};
|
|
14
|
+
export type OptionAxisType = "swatch" | "chip" | "image-tile" | "pack";
|
|
15
|
+
export type OptionValue = {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
/** Any CSS colour; product data, so it is the one place a literal colour is allowed. */
|
|
19
|
+
swatch?: string;
|
|
20
|
+
image?: string;
|
|
21
|
+
hint?: string;
|
|
22
|
+
/** Quantity of the base unit this value contains, for per-unit pricing on pack axes. */
|
|
23
|
+
quantity?: number;
|
|
24
|
+
};
|
|
25
|
+
export type OptionAxis = {
|
|
26
|
+
id: string;
|
|
27
|
+
label: string;
|
|
28
|
+
type: OptionAxisType;
|
|
29
|
+
values: OptionValue[];
|
|
30
|
+
guide?: {
|
|
31
|
+
label: string;
|
|
32
|
+
onClick: () => void;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type VariantSelection = Record<string, string>;
|
|
36
|
+
export type ProductVariant = {
|
|
37
|
+
id: string;
|
|
38
|
+
/** Axis id to option value id; a variant with every axis set is fully specified. */
|
|
39
|
+
options: VariantSelection;
|
|
40
|
+
price: number;
|
|
41
|
+
mrp?: number;
|
|
42
|
+
/** Undefined means untracked and sellable; 0 means sold out. */
|
|
43
|
+
stock?: number;
|
|
44
|
+
backorder?: boolean;
|
|
45
|
+
sku?: string;
|
|
46
|
+
mediaIds?: string[];
|
|
47
|
+
};
|
|
48
|
+
export type StockState = "in-stock" | "low-stock" | "out-of-stock" | "backorder";
|
|
49
|
+
export type PriceFormat = {
|
|
50
|
+
currency?: string;
|
|
51
|
+
locale?: string;
|
|
52
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OptionAxis, ProductVariant, StockState, VariantSelection } from "./commerceTypes";
|
|
2
|
+
export declare const LOW_STOCK_THRESHOLD = 5;
|
|
3
|
+
export declare function stockState(variant: Pick<ProductVariant, "stock" | "backorder"> | undefined, threshold?: number): StockState;
|
|
4
|
+
export declare function selectionComplete(axes: OptionAxis[], selection: VariantSelection): boolean;
|
|
5
|
+
export declare function findVariant(axes: OptionAxis[], variants: ProductVariant[], selection: VariantSelection): ProductVariant | undefined;
|
|
6
|
+
/** A value is offered when some sellable variant has it alongside the other axes' current picks. */
|
|
7
|
+
export declare function isOptionAvailable(variants: ProductVariant[], selection: VariantSelection, axisId: string, valueId: string): boolean;
|
|
8
|
+
export declare function remainingStock(variants: ProductVariant[], selection: VariantSelection, axisId: string, valueId: string): number | undefined;
|
|
9
|
+
export declare function priceRange(variants: ProductVariant[]): {
|
|
10
|
+
min: number;
|
|
11
|
+
max: number;
|
|
12
|
+
} | null;
|
|
13
|
+
export declare function firstAvailableSelection(variants: ProductVariant[]): VariantSelection;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LOW_STOCK_THRESHOLD = void 0;
|
|
4
|
+
exports.stockState = stockState;
|
|
5
|
+
exports.selectionComplete = selectionComplete;
|
|
6
|
+
exports.findVariant = findVariant;
|
|
7
|
+
exports.isOptionAvailable = isOptionAvailable;
|
|
8
|
+
exports.remainingStock = remainingStock;
|
|
9
|
+
exports.priceRange = priceRange;
|
|
10
|
+
exports.firstAvailableSelection = firstAvailableSelection;
|
|
11
|
+
exports.LOW_STOCK_THRESHOLD = 5;
|
|
12
|
+
function stockState(variant, threshold = exports.LOW_STOCK_THRESHOLD) {
|
|
13
|
+
if (!variant || variant.stock === undefined)
|
|
14
|
+
return "in-stock";
|
|
15
|
+
if (variant.stock > 0)
|
|
16
|
+
return variant.stock <= threshold ? "low-stock" : "in-stock";
|
|
17
|
+
return variant.backorder ? "backorder" : "out-of-stock";
|
|
18
|
+
}
|
|
19
|
+
const sellable = (variant) => stockState(variant) !== "out-of-stock";
|
|
20
|
+
const matches = (variant, selection) => Object.entries(selection).every(([axisId, valueId]) => variant.options[axisId] === valueId);
|
|
21
|
+
function selectionComplete(axes, selection) {
|
|
22
|
+
return axes.every((axis) => selection[axis.id] !== undefined);
|
|
23
|
+
}
|
|
24
|
+
function findVariant(axes, variants, selection) {
|
|
25
|
+
if (!selectionComplete(axes, selection))
|
|
26
|
+
return undefined;
|
|
27
|
+
return variants.find((variant) => matches(variant, selection));
|
|
28
|
+
}
|
|
29
|
+
/** A value is offered when some sellable variant has it alongside the other axes' current picks. */
|
|
30
|
+
function isOptionAvailable(variants, selection, axisId, valueId) {
|
|
31
|
+
const probe = { ...selection, [axisId]: valueId };
|
|
32
|
+
return variants.some((variant) => sellable(variant) && matches(variant, probe));
|
|
33
|
+
}
|
|
34
|
+
function remainingStock(variants, selection, axisId, valueId) {
|
|
35
|
+
const probe = { ...selection, [axisId]: valueId };
|
|
36
|
+
const hits = variants.filter((variant) => matches(variant, probe) && sellable(variant));
|
|
37
|
+
if (hits.length === 0 || hits.some((variant) => variant.stock === undefined))
|
|
38
|
+
return undefined;
|
|
39
|
+
return hits.reduce((sum, variant) => { var _a; return sum + ((_a = variant.stock) !== null && _a !== void 0 ? _a : 0); }, 0);
|
|
40
|
+
}
|
|
41
|
+
function priceRange(variants) {
|
|
42
|
+
if (variants.length === 0)
|
|
43
|
+
return null;
|
|
44
|
+
const prices = variants.map((variant) => variant.price);
|
|
45
|
+
return { min: Math.min(...prices), max: Math.max(...prices) };
|
|
46
|
+
}
|
|
47
|
+
function firstAvailableSelection(variants) {
|
|
48
|
+
var _a;
|
|
49
|
+
const first = (_a = variants.find(sellable)) !== null && _a !== void 0 ? _a : variants[0];
|
|
50
|
+
return first ? { ...first.options } : {};
|
|
51
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./commerceTypes"), exports);
|
|
18
|
+
__exportStar(require("./commerceVariants"), exports);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useContainerWidth = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
/** Width of the referenced element, or undefined until measurable (SSR, jsdom, no ResizeObserver). */
|
|
6
|
+
const useContainerWidth = (ref) => {
|
|
7
|
+
const [width, setWidth] = (0, react_1.useState)(undefined);
|
|
8
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
9
|
+
const node = ref.current;
|
|
10
|
+
if (!node)
|
|
11
|
+
return undefined;
|
|
12
|
+
const measure = () => {
|
|
13
|
+
const next = node.getBoundingClientRect().width;
|
|
14
|
+
setWidth(next > 0 ? Math.round(next) : undefined);
|
|
15
|
+
};
|
|
16
|
+
measure();
|
|
17
|
+
if (typeof ResizeObserver === "undefined")
|
|
18
|
+
return undefined;
|
|
19
|
+
const observer = new ResizeObserver(measure);
|
|
20
|
+
observer.observe(node);
|
|
21
|
+
return () => observer.disconnect();
|
|
22
|
+
}, [ref]);
|
|
23
|
+
return width;
|
|
24
|
+
};
|
|
25
|
+
exports.useContainerWidth = useContainerWidth;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CouponFieldProps } from "./CouponFieldProps";
|
|
2
|
+
/** Coupon entry that stays out of the way: a quiet prompt row, a field with tap-to-apply offers, then an applied state with the saving. */
|
|
3
|
+
declare const CouponField: ({ status, appliedCode, savedAmount, error, onApply, onRemove, suggestions, value, defaultValue, onValueChange, expanded, defaultExpanded, onExpandedChange, currency, locale, labels, "data-testid": testId, }: CouponFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default CouponField;
|
|
@@ -0,0 +1,72 @@
|
|
|
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 motion_1 = require("../../Theme/tokens/primitives/motion");
|
|
12
|
+
const motion_2 = require("../../Theme/chakra/motion");
|
|
13
|
+
const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
|
|
14
|
+
const tone_1 = require("../../Theme/tokens/builders/tone");
|
|
15
|
+
const price_1 = require("../../Utils/price");
|
|
16
|
+
const Button_1 = __importDefault(require("../Button/Button"));
|
|
17
|
+
const TextInput_1 = __importDefault(require("../Input/TextInput"));
|
|
18
|
+
const DEFAULT_LABELS = {
|
|
19
|
+
prompt: "Have a coupon?",
|
|
20
|
+
inputLabel: "Coupon code",
|
|
21
|
+
placeholder: "Enter code",
|
|
22
|
+
apply: "Apply",
|
|
23
|
+
remove: "Remove",
|
|
24
|
+
suggestionsTitle: "Available offers",
|
|
25
|
+
applied: (code) => `${code} applied`,
|
|
26
|
+
saved: (amount) => `You saved ${amount}`,
|
|
27
|
+
applySuggestion: (code) => `Apply ${code}`,
|
|
28
|
+
};
|
|
29
|
+
const normalise = (raw) => raw.replace(/\s+/g, "").toUpperCase();
|
|
30
|
+
/** Coupon entry that stays out of the way: a quiet prompt row, a field with tap-to-apply offers, then an applied state with the saving. */
|
|
31
|
+
const CouponField = ({ status = "idle", appliedCode, savedAmount, error, onApply, onRemove, suggestions, value, defaultValue = "", onValueChange, expanded, defaultExpanded = false, onExpandedChange, currency, locale, labels, "data-testid": testId, }) => {
|
|
32
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
33
|
+
const uid = (0, react_1.useId)();
|
|
34
|
+
const panelId = `${uid}-panel`;
|
|
35
|
+
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
36
|
+
const [innerText, setInnerText] = (0, react_1.useState)(defaultValue);
|
|
37
|
+
const [innerOpen, setInnerOpen] = (0, react_1.useState)(defaultExpanded);
|
|
38
|
+
const text = value !== null && value !== void 0 ? value : innerText;
|
|
39
|
+
const applying = status === "applying";
|
|
40
|
+
const open = (expanded !== null && expanded !== void 0 ? expanded : innerOpen) || applying || status === "error";
|
|
41
|
+
const setText = (next) => {
|
|
42
|
+
if (value === undefined)
|
|
43
|
+
setInnerText(next);
|
|
44
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(next);
|
|
45
|
+
};
|
|
46
|
+
const setOpen = (next) => {
|
|
47
|
+
if (expanded === undefined)
|
|
48
|
+
setInnerOpen(next);
|
|
49
|
+
onExpandedChange === null || onExpandedChange === void 0 ? void 0 : onExpandedChange(next);
|
|
50
|
+
};
|
|
51
|
+
const submit = (code) => {
|
|
52
|
+
const clean = normalise(code);
|
|
53
|
+
if (!clean || applying)
|
|
54
|
+
return;
|
|
55
|
+
onApply === null || onApply === void 0 ? void 0 : onApply(clean);
|
|
56
|
+
};
|
|
57
|
+
const onKeyDown = (event) => {
|
|
58
|
+
if (event.key === "Enter" && event.target.tagName === "INPUT") {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
submit(text);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const success = (0, tone_1.resolveSoftTone)(colors, (0, tone_1.toneScale)(colors, "success"), colors.background[100]);
|
|
64
|
+
if (status === "applied" && appliedCode) {
|
|
65
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 3, p: 3, pl: 4, borderRadius: "1rem", bg: colors.background[100], "data-testid": testId, "data-status": "applied", children: [(0, jsx_runtime_1.jsx)(react_2.Flex, { as: "span", align: "center", justify: "center", boxSize: 8, flexShrink: 0, borderRadius: "full", bg: success.bg, color: success.fg, children: (0, jsx_runtime_1.jsx)(lucide_react_1.BadgeCheck, { size: 16, "aria-hidden": true }) }), (0, jsx_runtime_1.jsxs)(react_2.Box, { flex: 1, minW: 0, role: "status", children: [(0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", display: "block", fontSize: "sm", fontWeight: 700, lineHeight: 1.4, color: colors.header[900], noOfLines: 1, children: copy.applied(appliedCode) }), savedAmount !== undefined && savedAmount > 0 && ((0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", display: "block", fontSize: "xs", fontWeight: 600, lineHeight: 1.4, color: colors.semanticText.success, sx: { fontVariantNumeric: "tabular-nums" }, children: copy.saved((0, price_1.formatPrice)(savedAmount, { currency, locale })) }))] }), (0, jsx_runtime_1.jsx)(Button_1.default, { variant: "ghost", colorScheme: "gray", size: "sm", onClick: onRemove, "aria-label": `${copy.remove} coupon ${appliedCode}`, children: copy.remove })] }));
|
|
66
|
+
}
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { direction: "column", gap: 3, "data-testid": testId, "data-status": status, children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { as: "button", type: "button", "aria-expanded": open, "aria-controls": panelId, disabled: applying || status === "error", onClick: () => setOpen(!open), display: "flex", alignItems: "center", gap: 3, w: "100%", minH: "3rem", px: 4, borderRadius: "1rem", bg: colors.background[100], color: colors.header[900], textAlign: "left", transition: (0, motion_1.transitionFor)(["background-color"]), _hover: { bg: colors.background[200] }, sx: { ...(0, focusRing_styles_1.focusVisibleStyles)(colors), ...(0, motion_2.reducedMotionSx)() }, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Ticket, { size: 18, "aria-hidden": true }), (0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", flex: 1, fontSize: "sm", fontWeight: 600, children: copy.prompt }), (0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-flex", "aria-hidden": true, transform: open ? "rotate(180deg)" : undefined, transition: (0, motion_1.transitionFor)(["transform"]), sx: (0, motion_2.reducedMotionSx)({ transform: open ? "rotate(180deg)" : "none" }), children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: 16 }) })] }), (0, jsx_runtime_1.jsxs)(react_2.Box, { id: panelId, hidden: !open, display: open ? "block" : "none", onKeyDown: onKeyDown, children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { gap: 2, align: "flex-start", children: [(0, jsx_runtime_1.jsx)(react_2.Box, { flex: 1, minW: 0, children: (0, jsx_runtime_1.jsx)(TextInput_1.default, { size: "lg", variant: "filled", "aria-label": copy.inputLabel, placeholder: copy.placeholder, value: text, onChange: (event) => setText(normalise(event.target.value)), error: status === "error", errorMessage: status === "error" ? error : undefined, isDisabled: applying, autoComplete: "off", autoCapitalize: "characters", spellCheck: false }) }), (0, jsx_runtime_1.jsx)(Button_1.default, { variant: "outline", colorScheme: "gray", size: "lg", isLoading: applying, isDisabled: !normalise(text), onClick: () => submit(text), children: copy.apply })] }), suggestions && suggestions.length > 0 && ((0, jsx_runtime_1.jsxs)(react_2.Box, { mt: 4, children: [(0, jsx_runtime_1.jsx)(react_2.Text, { as: "p", fontSize: "xs", fontWeight: 600, color: colors.textMuted, mb: 2, children: copy.suggestionsTitle }), (0, jsx_runtime_1.jsx)(react_2.Flex, { as: "ul", direction: "column", gap: 2, m: 0, p: 0, listStyleType: "none", children: suggestions.map((s) => ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "li", children: (0, jsx_runtime_1.jsxs)(react_2.Box, { as: "button", type: "button", disabled: applying, "aria-label": `${copy.applySuggestion(s.code)}: ${s.title}`, onClick: () => {
|
|
68
|
+
setText(s.code);
|
|
69
|
+
submit(s.code);
|
|
70
|
+
}, display: "flex", alignItems: "center", gap: 3, w: "100%", p: 3, borderRadius: "0.75rem", bg: colors.background[100], textAlign: "left", transition: (0, motion_1.transitionFor)(["background-color"]), _hover: { bg: colors.background[200] }, _disabled: { cursor: "not-allowed", opacity: 0.6 }, sx: { ...(0, focusRing_styles_1.focusVisibleStyles)(colors), ...(0, motion_2.reducedMotionSx)() }, children: [(0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", flexShrink: 0, px: 2, py: 1, borderRadius: "0.5rem", bg: colors.background[200], fontSize: "xs", fontWeight: 700, letterSpacing: "0.04em", color: colors.header[900], children: s.code }), (0, jsx_runtime_1.jsxs)(react_2.Box, { as: "span", flex: 1, minW: 0, children: [(0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", display: "block", fontSize: "sm", fontWeight: 600, lineHeight: 1.4, color: colors.header[900], children: s.title }), s.detail && ((0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", display: "block", fontSize: "xs", lineHeight: 1.4, color: colors.textMuted, children: s.detail }))] }), (0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", "aria-hidden": true, fontSize: "sm", fontWeight: 600, color: colors.accentText, children: copy.apply })] }) }, s.code))) })] }))] }), (0, jsx_runtime_1.jsx)(react_2.VisuallyHidden, { role: "status", children: applying ? `${copy.apply}…` : "" })] }));
|
|
71
|
+
};
|
|
72
|
+
exports.default = CouponField;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { PriceFormat } from "../Commerce/commerceTypes";
|
|
2
|
+
/** Where the coupon is in its lifecycle; the parent owns it because validation is a server call. */
|
|
3
|
+
export type CouponStatus = "idle" | "applying" | "applied" | "error";
|
|
4
|
+
/** A coupon the shopper can apply with one tap. */
|
|
5
|
+
export interface CouponSuggestion {
|
|
6
|
+
code: string;
|
|
7
|
+
title: string;
|
|
8
|
+
/** Terms line, e.g. "Min. order ₹999". */
|
|
9
|
+
detail?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Visible copy; override every string for another language. */
|
|
12
|
+
export interface CouponFieldLabels {
|
|
13
|
+
prompt: string;
|
|
14
|
+
inputLabel: string;
|
|
15
|
+
placeholder: string;
|
|
16
|
+
apply: string;
|
|
17
|
+
remove: string;
|
|
18
|
+
suggestionsTitle: string;
|
|
19
|
+
/** Status text once applied, given the code. */
|
|
20
|
+
applied: (code: string) => string;
|
|
21
|
+
/** Saving text once applied, given the formatted amount. */
|
|
22
|
+
saved: (amount: string) => string;
|
|
23
|
+
/** Accessible name of a suggestion, given its code. */
|
|
24
|
+
applySuggestion: (code: string) => string;
|
|
25
|
+
}
|
|
26
|
+
/** Controlled coupon entry: a collapsed "Have a coupon?" row that opens into a field, then settles into an applied chip. */
|
|
27
|
+
export interface CouponFieldProps extends PriceFormat {
|
|
28
|
+
status?: CouponStatus;
|
|
29
|
+
/** The code shown in the applied state. */
|
|
30
|
+
appliedCode?: string;
|
|
31
|
+
/** Saving from the applied code; shown as "You saved ₹150". */
|
|
32
|
+
savedAmount?: number;
|
|
33
|
+
/** Message shown under the field while `status` is "error"; announced as an alert. */
|
|
34
|
+
error?: string;
|
|
35
|
+
/** Called with the upper-cased code from the button, Enter, or a suggestion; set `status` to "applying" while it resolves. */
|
|
36
|
+
onApply?: (code: string) => void;
|
|
37
|
+
onRemove?: () => void;
|
|
38
|
+
suggestions?: CouponSuggestion[];
|
|
39
|
+
/** Input text when controlled. */
|
|
40
|
+
value?: string;
|
|
41
|
+
defaultValue?: string;
|
|
42
|
+
onValueChange?: (value: string) => void;
|
|
43
|
+
/** Open state of the collapsed row when controlled; the field is always open while applying or in error. */
|
|
44
|
+
expanded?: boolean;
|
|
45
|
+
defaultExpanded?: boolean;
|
|
46
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
47
|
+
labels?: Partial<CouponFieldLabels>;
|
|
48
|
+
"data-testid"?: string;
|
|
49
|
+
}
|
|
@@ -44,7 +44,7 @@ export type BaseDatePickerProps = {
|
|
|
44
44
|
width?: string | number;
|
|
45
45
|
/** Blocks today in the calendar and in typed input; the single picker preselects tomorrow instead. */
|
|
46
46
|
disableToday?: boolean;
|
|
47
|
-
/** Control-scale height: xs
|
|
47
|
+
/** Control-scale height: xs 32 · sm 38 · md 40 · lg 48px (default `sm`, like TextInput); also scales the calendar/clock icon. */
|
|
48
48
|
size?: "xs" | "sm" | "md" | "lg";
|
|
49
49
|
};
|
|
50
50
|
/** Single-date variant, Date API (default) — `isRange` must be false or omitted; this is the discriminant the DatePickerProps union switches on. */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const usePickerPortal: (isOpen: boolean) => {
|
|
3
|
+
isMounted: boolean;
|
|
4
|
+
isPopoverOpen: boolean;
|
|
5
|
+
};
|
|
6
|
+
type PickerPortalProps = {
|
|
7
|
+
isMounted: boolean;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare const PickerPortal: ({ isMounted, children }: PickerPortalProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export default PickerPortal;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PickerPortal = exports.usePickerPortal = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_2 = require("@chakra-ui/react");
|
|
7
|
+
const framer_motion_1 = require("framer-motion");
|
|
8
|
+
// NOTE: mounts on first open, after any open Modal's aria-hidden pass, then opens a render later.
|
|
9
|
+
const usePickerPortal = (isOpen) => {
|
|
10
|
+
const [hasMounted, setHasMounted] = (0, react_1.useState)(false);
|
|
11
|
+
(0, react_1.useEffect)(() => {
|
|
12
|
+
if (isOpen)
|
|
13
|
+
setHasMounted(true);
|
|
14
|
+
}, [isOpen]);
|
|
15
|
+
return { isMounted: isOpen || hasMounted, isPopoverOpen: isOpen && hasMounted };
|
|
16
|
+
};
|
|
17
|
+
exports.usePickerPortal = usePickerPortal;
|
|
18
|
+
// NOTE: detaches from an ancestor Modal's variant tree, which otherwise pins a late-mounted popover hidden.
|
|
19
|
+
const ROOT_MOTION_CONTEXT = {};
|
|
20
|
+
const BodyPortal = ({ children }) => {
|
|
21
|
+
const bodyRef = (0, react_1.useRef)(document.body);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Portal, { containerRef: bodyRef, children: (0, jsx_runtime_1.jsx)(framer_motion_1.MotionContext.Provider, { value: ROOT_MOTION_CONTEXT, children: children }) }));
|
|
23
|
+
};
|
|
24
|
+
const PickerPortal = ({ isMounted, children }) => isMounted ? (0, jsx_runtime_1.jsx)(BodyPortal, { children: children }) : null;
|
|
25
|
+
exports.PickerPortal = PickerPortal;
|
|
26
|
+
exports.default = exports.PickerPortal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { RangeDatePickerProps } from "./DatePickerProps";
|
|
3
|
-
/** Two-endpoint range field; `onChange` fires
|
|
3
|
+
/** Two-endpoint range field; `onChange` fires on Apply, outside click or Escape in the calendar — never on a bare day click. */
|
|
4
4
|
export declare const RangeDatePicker: React.FC<RangeDatePickerProps>;
|
|
5
5
|
export default RangeDatePicker;
|