pixelize-design-library 2.4.2-beta.56 → 2.4.2-beta.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -0
- package/COMPONENT-GOTCHAS.md +48 -20
- package/DESIGN-GUIDE.md +18 -1
- package/dist/Components/AddressCard/AddressCard.d.ts +4 -0
- package/dist/Components/AddressCard/AddressCard.js +25 -0
- package/dist/Components/AddressCard/AddressCardGroup.d.ts +4 -0
- package/dist/Components/AddressCard/AddressCardGroup.js +7 -0
- package/dist/Components/AddressCard/AddressCardProps.d.ts +43 -0
- package/dist/Components/AddressCard/AddressCardProps.js +2 -0
- package/dist/Components/BagBar/BagBar.d.ts +4 -0
- package/dist/Components/BagBar/BagBar.js +32 -0
- package/dist/Components/BagBar/BagBarProps.d.ts +30 -0
- package/dist/Components/BagBar/BagBarProps.js +2 -0
- package/dist/Components/CartItem/CartItem.d.ts +4 -0
- package/dist/Components/CartItem/CartItem.js +60 -0
- package/dist/Components/CartItem/CartItemProps.d.ts +64 -0
- package/dist/Components/CartItem/CartItemProps.js +2 -0
- package/dist/Components/CartItem/cartItemOptions.d.ts +3 -0
- package/dist/Components/CartItem/cartItemOptions.js +13 -0
- package/dist/Components/CheckoutKit/selectable.d.ts +58 -0
- package/dist/Components/CheckoutKit/selectable.js +120 -0
- package/dist/Components/Commerce/commerceTypes.d.ts +52 -0
- package/dist/Components/Commerce/commerceTypes.js +2 -0
- package/dist/Components/Commerce/commerceVariants.d.ts +13 -0
- package/dist/Components/Commerce/commerceVariants.js +51 -0
- package/dist/Components/Commerce/index.d.ts +2 -0
- package/dist/Components/Commerce/index.js +18 -0
- package/dist/Components/Commerce/useContainerWidth.d.ts +3 -0
- package/dist/Components/Commerce/useContainerWidth.js +25 -0
- package/dist/Components/CouponField/CouponField.d.ts +4 -0
- package/dist/Components/CouponField/CouponField.js +72 -0
- package/dist/Components/CouponField/CouponFieldProps.d.ts +49 -0
- package/dist/Components/CouponField/CouponFieldProps.js +2 -0
- package/dist/Components/DatePicker/PickerPortal.d.ts +11 -0
- package/dist/Components/DatePicker/PickerPortal.js +26 -0
- package/dist/Components/DatePicker/RangeDatePicker.d.ts +1 -1
- package/dist/Components/DatePicker/RangeDatePicker.js +67 -32
- package/dist/Components/DatePicker/SingleDatePicker.js +49 -13
- package/dist/Components/DatePicker/TimeOnlyPicker.js +39 -4
- package/dist/Components/DetailSections/DetailSections.d.ts +4 -0
- package/dist/Components/DetailSections/DetailSections.js +112 -0
- package/dist/Components/DetailSections/DetailSectionsProps.d.ts +58 -0
- package/dist/Components/DetailSections/DetailSectionsProps.js +2 -0
- package/dist/Components/MediaGallery/MediaFrame.d.ts +31 -0
- package/dist/Components/MediaGallery/MediaFrame.js +55 -0
- package/dist/Components/MediaGallery/MediaGallery.d.ts +4 -0
- package/dist/Components/MediaGallery/MediaGallery.js +206 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.d.ts +76 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.js +20 -0
- package/dist/Components/MediaGallery/MediaLightbox.d.ts +4 -0
- package/dist/Components/MediaGallery/MediaLightbox.js +116 -0
- package/dist/Components/MediaGallery/MediaLightboxProps.d.ts +40 -0
- package/dist/Components/MediaGallery/MediaLightboxProps.js +15 -0
- package/dist/Components/MediaGallery/MediaThumb.d.ts +18 -0
- package/dist/Components/MediaGallery/MediaThumb.js +25 -0
- package/dist/Components/MediaGallery/glass.d.ts +31 -0
- package/dist/Components/MediaGallery/glass.js +47 -0
- package/dist/Components/MediaGallery/mediaGalleryModel.d.ts +22 -0
- package/dist/Components/MediaGallery/mediaGalleryModel.js +83 -0
- package/dist/Components/MediaGallery/motion.d.ts +5 -0
- package/dist/Components/MediaGallery/motion.js +12 -0
- package/dist/Components/MediaGallery/useMatchMedia.d.ts +2 -0
- package/dist/Components/MediaGallery/useMatchMedia.js +20 -0
- package/dist/Components/OffersList/OffersList.d.ts +4 -0
- package/dist/Components/OffersList/OffersList.js +83 -0
- package/dist/Components/OffersList/OffersListProps.d.ts +34 -0
- package/dist/Components/OffersList/OffersListProps.js +2 -0
- package/dist/Components/OptionChip/OptionChip.d.ts +4 -0
- package/dist/Components/OptionChip/OptionChip.js +97 -0
- package/dist/Components/OptionChip/OptionChipProps.d.ts +33 -0
- package/dist/Components/OptionChip/OptionChipProps.js +2 -0
- package/dist/Components/OptionChip/optionInk.d.ts +12 -0
- package/dist/Components/OptionChip/optionInk.js +25 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.d.ts +4 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.js +57 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.d.ts +29 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +2 -0
- package/dist/Components/OrderSummary/OrderSummary.d.ts +4 -0
- package/dist/Components/OrderSummary/OrderSummary.js +63 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.d.ts +53 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.js +2 -0
- package/dist/Components/PaymentOption/PaymentOption.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOption.js +24 -0
- package/dist/Components/PaymentOption/PaymentOptionGroup.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOptionGroup.js +7 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.d.ts +32 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.js +2 -0
- package/dist/Components/PincodeChecker/PincodeChecker.d.ts +4 -0
- package/dist/Components/PincodeChecker/PincodeChecker.js +175 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.d.ts +57 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.js +2 -0
- package/dist/Components/PriceBlock/PriceBlock.d.ts +4 -0
- package/dist/Components/PriceBlock/PriceBlock.js +41 -0
- package/dist/Components/PriceBlock/PriceBlockProps.d.ts +39 -0
- package/dist/Components/PriceBlock/PriceBlockProps.js +2 -0
- package/dist/Components/ProductBadges/ProductBadges.d.ts +4 -0
- package/dist/Components/ProductBadges/ProductBadges.js +61 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.d.ts +18 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.js +2 -0
- package/dist/Components/ProductCard/ProductCard.d.ts +3 -2
- package/dist/Components/ProductCard/ProductCard.js +103 -52
- package/dist/Components/ProductCard/ProductCardAction.d.ts +17 -0
- package/dist/Components/ProductCard/ProductCardAction.js +65 -0
- package/dist/Components/ProductCard/ProductCardGrid.d.ts +4 -0
- package/dist/Components/ProductCard/ProductCardGrid.js +20 -0
- package/dist/Components/ProductCard/ProductCardMedia.d.ts +18 -0
- package/dist/Components/ProductCard/ProductCardMedia.js +35 -0
- package/dist/Components/ProductCard/ProductCardProps.d.ts +138 -56
- package/dist/Components/ProductCard/ProductCardSkeleton.d.ts +4 -0
- package/dist/Components/ProductCard/ProductCardSkeleton.js +17 -0
- package/dist/Components/ProductCard/ProductCardSwatches.d.ts +15 -0
- package/dist/Components/ProductCard/ProductCardSwatches.js +37 -0
- package/dist/Components/ProductCard/QuickAddSheet.d.ts +4 -0
- package/dist/Components/ProductCard/QuickAddSheet.js +109 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.d.ts +38 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.js +2 -0
- package/dist/Components/ProductCard/cardLabels.d.ts +2 -0
- package/dist/Components/ProductCard/cardLabels.js +16 -0
- package/dist/Components/ProductCard/cardMetrics.d.ts +27 -0
- package/dist/Components/ProductCard/cardMetrics.js +55 -0
- package/dist/Components/ProductCard/productCardFixtures.d.ts +7 -0
- package/dist/Components/ProductCard/productCardFixtures.js +61 -0
- package/dist/Components/ProductCard/productCardModel.d.ts +22 -0
- package/dist/Components/ProductCard/productCardModel.js +79 -0
- package/dist/Components/ProductCard/useMinWidth.d.ts +2 -0
- package/dist/Components/ProductCard/useMinWidth.js +20 -0
- package/dist/Components/ProductDetails/ProductDetails.d.ts +3 -2
- package/dist/Components/ProductDetails/ProductDetails.js +209 -33
- package/dist/Components/ProductDetails/ProductDetailsProps.d.ts +143 -41
- package/dist/Components/ProductDetails/productDetailsModel.d.ts +14 -0
- package/dist/Components/ProductDetails/productDetailsModel.js +45 -0
- package/dist/Components/ProductDetails/useInViewport.d.ts +3 -0
- package/dist/Components/ProductDetails/useInViewport.js +18 -0
- package/dist/Components/QuantityStepper/QuantityStepper.d.ts +4 -0
- package/dist/Components/QuantityStepper/QuantityStepper.js +59 -0
- package/dist/Components/QuantityStepper/QuantityStepperProps.d.ts +24 -0
- package/dist/Components/QuantityStepper/QuantityStepperProps.js +2 -0
- package/dist/Components/Rating/Rating.d.ts +4 -0
- package/dist/Components/Rating/Rating.js +81 -0
- package/dist/Components/Rating/RatingProps.d.ts +27 -0
- package/dist/Components/Rating/RatingProps.js +2 -0
- package/dist/Components/ReviewList/ReviewList.d.ts +4 -0
- package/dist/Components/ReviewList/ReviewList.js +94 -0
- package/dist/Components/ReviewList/ReviewListProps.d.ts +68 -0
- package/dist/Components/ReviewList/ReviewListProps.js +2 -0
- package/dist/Components/ReviewSummary/ReviewSummary.d.ts +4 -0
- package/dist/Components/ReviewSummary/ReviewSummary.js +47 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.d.ts +31 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.js +2 -0
- package/dist/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/Components/SegmentedControl/SegmentedControl.js +17 -5
- package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +6 -0
- package/dist/Components/SegmentedControl/segmentedInk.d.ts +2 -0
- package/dist/Components/SegmentedControl/segmentedInk.js +4 -1
- package/dist/Components/SegmentedControl/useSlidingPill.d.ts +2 -0
- package/dist/Components/SegmentedControl/useSlidingPill.js +6 -1
- package/dist/Components/SideBar/SecondaryBar.js +13 -8
- package/dist/Components/SideBar/SideBarProps.d.ts +3 -1
- package/dist/Components/SideBar/components/MenuItemBox.js +47 -10
- package/dist/Components/SideBar/components/MenuPopoverContent.js +4 -3
- package/dist/Components/SpecTable/SpecTable.d.ts +4 -0
- package/dist/Components/SpecTable/SpecTable.js +39 -0
- package/dist/Components/SpecTable/SpecTableProps.d.ts +25 -0
- package/dist/Components/SpecTable/SpecTableProps.js +2 -0
- package/dist/Components/Spinner/Spinner.d.ts +1 -1
- package/dist/Components/Spinner/Spinner.js +2 -2
- package/dist/Components/Spinner/SpinnerProps.d.ts +2 -0
- package/dist/Components/StageProgress/StepperStage.js +2 -1
- package/dist/Components/StatCard/StatCard.d.ts +1 -1
- package/dist/Components/StatCard/StatCard.js +2 -2
- package/dist/Components/StatCard/StatCardProps.d.ts +4 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.d.ts +3 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.js +85 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.d.ts +54 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.js +2 -0
- package/dist/Components/StockStatus/StockStatus.d.ts +4 -0
- package/dist/Components/StockStatus/StockStatus.js +31 -0
- package/dist/Components/StockStatus/StockStatusProps.d.ts +14 -0
- package/dist/Components/StockStatus/StockStatusProps.js +2 -0
- package/dist/Components/Table/Table.js +2 -1
- package/dist/Components/Table/TableProps.d.ts +5 -2
- package/dist/Components/Table/columnLabel.d.ts +6 -0
- package/dist/Components/Table/columnLabel.js +27 -0
- package/dist/Components/Table/components/TableBody.js +5 -1
- package/dist/Components/Table/components/TableHeader.js +3 -2
- package/dist/Components/Table/filters/ActiveFilters.js +2 -1
- package/dist/Components/Table/filters/TableFilters.js +2 -1
- package/dist/Components/Table/hooks/useTable.js +3 -2
- package/dist/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/Components/Table/settings/TableSettings.js +2 -1
- package/dist/Components/TrustBadges/TrustBadges.d.ts +4 -0
- package/dist/Components/TrustBadges/TrustBadges.js +24 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.d.ts +20 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.js +2 -0
- package/dist/Components/VariantSelector/VariantSelector.d.ts +4 -0
- package/dist/Components/VariantSelector/VariantSelector.js +123 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.d.ts +27 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.js +2 -0
- package/dist/Components/VariantSelector/variantSelection.d.ts +6 -0
- package/dist/Components/VariantSelector/variantSelection.js +25 -0
- package/dist/Components/WishlistToggle/WishlistToggle.d.ts +4 -0
- package/dist/Components/WishlistToggle/WishlistToggle.js +65 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.d.ts +19 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.js +2 -0
- package/dist/Theme/assertPalette.d.ts +1 -1
- package/dist/Theme/assertPalette.js +1 -1
- package/dist/Theme/tokens/brands/index.js +2 -0
- package/dist/Theme/tokens/brands/zinc/palette.dark.d.ts +1 -0
- package/dist/Theme/tokens/builders/buildDarkPalette.js +2 -0
- package/dist/Theme/tokens/builders/index.d.ts +1 -0
- package/dist/Theme/tokens/builders/index.js +1 -0
- package/dist/Theme/tokens/builders/rechartsTheme.d.ts +56 -0
- package/dist/Theme/tokens/builders/rechartsTheme.js +43 -0
- package/dist/Theme/tokens/builders/star.d.ts +3 -0
- package/dist/Theme/tokens/builders/star.js +8 -0
- package/dist/Theme/tokens/types.d.ts +3 -1
- package/dist/Theme/useChartTheme.d.ts +4 -0
- package/dist/Theme/useChartTheme.js +12 -0
- package/dist/Utils/price.d.ts +16 -0
- package/dist/Utils/price.js +34 -0
- package/dist/esm/Components/AddressCard/AddressCard.js +20 -0
- package/dist/esm/Components/AddressCard/AddressCardGroup.js +5 -0
- package/dist/esm/Components/AddressCard/AddressCardProps.js +1 -0
- package/dist/esm/Components/BagBar/BagBar.js +27 -0
- package/dist/esm/Components/BagBar/BagBarProps.js +1 -0
- package/dist/esm/Components/CartItem/CartItem.js +55 -0
- package/dist/esm/Components/CartItem/CartItemProps.js +1 -0
- package/dist/esm/Components/CartItem/cartItemOptions.js +9 -0
- package/dist/esm/Components/CheckoutKit/selectable.js +112 -0
- package/dist/esm/Components/Commerce/commerceTypes.js +1 -0
- package/dist/esm/Components/Commerce/commerceVariants.js +41 -0
- package/dist/esm/Components/Commerce/index.js +2 -0
- package/dist/esm/Components/Commerce/useContainerWidth.js +21 -0
- package/dist/esm/Components/CouponField/CouponField.js +67 -0
- package/dist/esm/Components/CouponField/CouponFieldProps.js +1 -0
- package/dist/esm/Components/DatePicker/PickerPortal.js +21 -0
- package/dist/esm/Components/DatePicker/RangeDatePicker.js +34 -32
- package/dist/esm/Components/DatePicker/SingleDatePicker.js +16 -13
- package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +6 -4
- package/dist/esm/Components/DetailSections/DetailSections.js +107 -0
- package/dist/esm/Components/DetailSections/DetailSectionsProps.js +1 -0
- package/dist/esm/Components/MediaGallery/MediaFrame.js +48 -0
- package/dist/esm/Components/MediaGallery/MediaGallery.js +201 -0
- package/dist/esm/Components/MediaGallery/MediaGalleryProps.js +17 -0
- package/dist/esm/Components/MediaGallery/MediaLightbox.js +78 -0
- package/dist/esm/Components/MediaGallery/MediaLightboxProps.js +12 -0
- package/dist/esm/Components/MediaGallery/MediaThumb.js +23 -0
- package/dist/esm/Components/MediaGallery/glass.js +42 -0
- package/dist/esm/Components/MediaGallery/mediaGalleryModel.js +71 -0
- package/dist/esm/Components/MediaGallery/motion.js +8 -0
- package/dist/esm/Components/MediaGallery/useMatchMedia.js +16 -0
- package/dist/esm/Components/OffersList/OffersList.js +81 -0
- package/dist/esm/Components/OffersList/OffersListProps.js +1 -0
- package/dist/esm/Components/OptionChip/OptionChip.js +95 -0
- package/dist/esm/Components/OptionChip/OptionChipProps.js +1 -0
- package/dist/esm/Components/OptionChip/optionInk.js +21 -0
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimeline.js +55 -0
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +1 -0
- package/dist/esm/Components/OrderSummary/OrderSummary.js +58 -0
- package/dist/esm/Components/OrderSummary/OrderSummaryProps.js +1 -0
- package/dist/esm/Components/PaymentOption/PaymentOption.js +19 -0
- package/dist/esm/Components/PaymentOption/PaymentOptionGroup.js +5 -0
- package/dist/esm/Components/PaymentOption/PaymentOptionProps.js +1 -0
- package/dist/esm/Components/PincodeChecker/PincodeChecker.js +170 -0
- package/dist/esm/Components/PincodeChecker/PincodeCheckerProps.js +1 -0
- package/dist/esm/Components/PriceBlock/PriceBlock.js +39 -0
- package/dist/esm/Components/PriceBlock/PriceBlockProps.js +1 -0
- package/dist/esm/Components/ProductBadges/ProductBadges.js +59 -0
- package/dist/esm/Components/ProductBadges/ProductBadgesProps.js +1 -0
- package/dist/esm/Components/ProductCard/ProductCard.js +105 -54
- package/dist/esm/Components/ProductCard/ProductCardAction.js +60 -0
- package/dist/esm/Components/ProductCard/ProductCardGrid.js +18 -0
- package/dist/esm/Components/ProductCard/ProductCardMedia.js +33 -0
- package/dist/esm/Components/ProductCard/ProductCardSkeleton.js +12 -0
- package/dist/esm/Components/ProductCard/ProductCardSwatches.js +35 -0
- package/dist/esm/Components/ProductCard/QuickAddSheet.js +71 -0
- package/dist/esm/Components/ProductCard/QuickAddSheetProps.js +1 -0
- package/dist/esm/Components/ProductCard/cardLabels.js +13 -0
- package/dist/esm/Components/ProductCard/cardMetrics.js +52 -0
- package/dist/esm/Components/ProductCard/productCardFixtures.js +58 -0
- package/dist/esm/Components/ProductCard/productCardModel.js +65 -0
- package/dist/esm/Components/ProductCard/useMinWidth.js +16 -0
- package/dist/esm/Components/ProductDetails/ProductDetails.js +210 -34
- package/dist/esm/Components/ProductDetails/productDetailsModel.js +35 -0
- package/dist/esm/Components/ProductDetails/useInViewport.js +14 -0
- package/dist/esm/Components/QuantityStepper/QuantityStepper.js +57 -0
- package/dist/esm/Components/QuantityStepper/QuantityStepperProps.js +1 -0
- package/dist/esm/Components/Rating/Rating.js +79 -0
- package/dist/esm/Components/Rating/RatingProps.js +1 -0
- package/dist/esm/Components/ReviewList/ReviewList.js +89 -0
- package/dist/esm/Components/ReviewList/ReviewListProps.js +1 -0
- package/dist/esm/Components/ReviewSummary/ReviewSummary.js +42 -0
- package/dist/esm/Components/ReviewSummary/ReviewSummaryProps.js +1 -0
- package/dist/esm/Components/SegmentedControl/SegmentedControl.js +19 -7
- package/dist/esm/Components/SegmentedControl/segmentedInk.js +2 -0
- package/dist/esm/Components/SegmentedControl/useSlidingPill.js +6 -1
- package/dist/esm/Components/SideBar/SecondaryBar.js +14 -9
- package/dist/esm/Components/SideBar/components/MenuItemBox.js +14 -10
- package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +4 -3
- package/dist/esm/Components/SpecTable/SpecTable.js +34 -0
- package/dist/esm/Components/SpecTable/SpecTableProps.js +1 -0
- package/dist/esm/Components/Spinner/Spinner.js +2 -2
- package/dist/esm/Components/StageProgress/StepperStage.js +2 -1
- package/dist/esm/Components/StatCard/StatCard.js +2 -2
- package/dist/esm/Components/StickyBuyBar/StickyBuyBar.js +80 -0
- package/dist/esm/Components/StickyBuyBar/StickyBuyBarProps.js +1 -0
- package/dist/esm/Components/StockStatus/StockStatus.js +29 -0
- package/dist/esm/Components/StockStatus/StockStatusProps.js +1 -0
- package/dist/esm/Components/Table/Table.js +2 -1
- package/dist/esm/Components/Table/columnLabel.js +21 -0
- package/dist/esm/Components/Table/components/TableBody.js +5 -1
- package/dist/esm/Components/Table/components/TableHeader.js +3 -2
- package/dist/esm/Components/Table/filters/ActiveFilters.js +2 -1
- package/dist/esm/Components/Table/filters/TableFilters.js +2 -1
- package/dist/esm/Components/Table/hooks/useTable.js +3 -2
- package/dist/esm/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/esm/Components/Table/settings/TableSettings.js +2 -1
- package/dist/esm/Components/TrustBadges/TrustBadges.js +22 -0
- package/dist/esm/Components/TrustBadges/TrustBadgesProps.js +1 -0
- package/dist/esm/Components/VariantSelector/VariantSelector.js +118 -0
- package/dist/esm/Components/VariantSelector/VariantSelectorProps.js +1 -0
- package/dist/esm/Components/VariantSelector/variantSelection.js +19 -0
- package/dist/esm/Components/WishlistToggle/WishlistToggle.js +63 -0
- package/dist/esm/Components/WishlistToggle/WishlistToggleProps.js +1 -0
- package/dist/esm/Theme/assertPalette.js +1 -1
- package/dist/esm/Theme/tokens/brands/index.js +2 -0
- package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +2 -0
- package/dist/esm/Theme/tokens/builders/index.js +1 -0
- package/dist/esm/Theme/tokens/builders/rechartsTheme.js +37 -0
- package/dist/esm/Theme/tokens/builders/star.js +4 -0
- package/dist/esm/Theme/useChartTheme.js +8 -0
- package/dist/esm/Utils/price.js +27 -0
- package/dist/esm/index.js +36 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +86 -4
- package/package.json +1 -1
- package/dist/Components/ProductCard/ProductLabel.d.ts +0 -7
- package/dist/Components/ProductCard/ProductLabel.js +0 -20
- package/dist/Components/ProductCard/ProductPrice.d.ts +0 -10
- package/dist/Components/ProductCard/ProductPrice.js +0 -126
- package/dist/Components/ProductCard/ProductReview.d.ts +0 -8
- package/dist/Components/ProductCard/ProductReview.js +0 -30
- package/dist/Components/ProductCard/ProductTags.d.ts +0 -8
- package/dist/Components/ProductCard/ProductTags.js +0 -53
- package/dist/Components/ProductDetails/ProductDtlPrice.d.ts +0 -7
- package/dist/Components/ProductDetails/ProductDtlPrice.js +0 -24
- package/dist/Components/ProductDetails/ProductImageSlider.d.ts +0 -13
- package/dist/Components/ProductDetails/ProductImageSlider.js +0 -240
- package/dist/esm/Components/ProductCard/ProductLabel.js +0 -18
- package/dist/esm/Components/ProductCard/ProductPrice.js +0 -121
- package/dist/esm/Components/ProductCard/ProductReview.js +0 -28
- package/dist/esm/Components/ProductCard/ProductTags.js +0 -48
- package/dist/esm/Components/ProductDetails/ProductDtlPrice.js +0 -22
- package/dist/esm/Components/ProductDetails/ProductImageSlider.js +0 -204
|
@@ -33,35 +33,40 @@ const parseBadge = (badge) => {
|
|
|
33
33
|
variant: (_c = badge === null || badge === void 0 ? void 0 : badge.variant) !== null && _c !== void 0 ? _c : "subtle",
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
|
+
// Matches MenuItemBox/MenuPopoverContent's isBlocked — locked also blocks, not just disabled.
|
|
37
|
+
const isItemBlocked = (item) => (0, menuDisabled_1.menuDisabled)(item) || !!item.locked;
|
|
36
38
|
const CollapsedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
|
|
37
39
|
var _a;
|
|
38
40
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
39
41
|
const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
|
|
40
42
|
const { badgeVal, colorScheme, radius, variant } = parseBadge(item.badge);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
const blocked = isItemBlocked(item);
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Popover, { trigger: "hover", placement: "right-start", closeOnBlur: false, isLazy: true, children: [(0, jsx_runtime_1.jsx)(react_2.PopoverTrigger, { children: (0, jsx_runtime_1.jsx)(react_2.Box, { as: "a", href: (_a = item.url) !== null && _a !== void 0 ? _a : "#", "data-group": "", "aria-label": item.title, "aria-current": isActive ? "page" : undefined, "aria-disabled": blocked ? true : undefined, textDecoration: "none", py: 2, mb: "2px", borderRadius: "lg", display: "flex", alignItems: "center", justifyContent: "center", cursor: blocked ? "not-allowed" : "pointer", opacity: blocked ? 0.6 : 1, borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", _hover: {
|
|
45
|
+
bg: blocked
|
|
43
46
|
? "transparent"
|
|
44
47
|
: isActive
|
|
45
48
|
? "whiteAlpha.400"
|
|
46
49
|
: "whiteAlpha.200",
|
|
47
50
|
}, onClick: (e) => {
|
|
48
51
|
e.preventDefault();
|
|
49
|
-
if (!
|
|
52
|
+
if (!blocked)
|
|
50
53
|
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item);
|
|
51
|
-
}, bg: isActive ? "whiteAlpha.300" : "transparent", transition: "background 0.12s", children: (0, jsx_runtime_1.jsxs)(react_2.Box, { position: "relative", display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), badgeVal != null && ((0, jsx_runtime_1.jsx)(react_2.Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.sidebar.semanticText.error }))] }) }) }), (0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsx)(react_2.PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", cursor:
|
|
54
|
+
}, bg: isActive ? "whiteAlpha.300" : "transparent", transition: "background 0.12s", children: (0, jsx_runtime_1.jsxs)(react_2.Box, { position: "relative", display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), badgeVal != null && ((0, jsx_runtime_1.jsx)(react_2.Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.sidebar.semanticText.error }))] }) }) }), (0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsx)(react_2.PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", cursor: blocked ? "not-allowed" : "pointer", zIndex: 1500, color: theme.colors.white, border: 'none', children: (0, jsx_runtime_1.jsx)(react_2.PopoverBody, { p: 3, children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, justify: "space-between", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, flex: "1", minW: 0, children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: "md", flexShrink: 0 }), (0, jsx_runtime_1.jsx)(OverflowTooltipText_1.default, { placement: "right", maxWidth: "100%", fontSize: itemFontSize, fontWeight: "medium", as: "p", children: item.title })] }), item.locked ? (item.lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: item.lockedReason, placement: "top", children: (0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon }) })) : ((0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon }))) : (badgeVal != null && ((0, jsx_runtime_1.jsx)(react_2.Badge, { ...softBadge(theme.colors, colorScheme, (0, sidebarAccent_1.sidebarRowPeak)(theme.colors.sidebar.elevated)), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal })))] }) }) }) })] }));
|
|
52
55
|
};
|
|
53
56
|
const ExpandedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
|
|
54
57
|
var _a;
|
|
55
58
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
56
59
|
const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
|
|
57
60
|
const { badgeVal, colorScheme, radius, variant } = parseBadge(item.badge);
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
const blocked = isItemBlocked(item);
|
|
62
|
+
const row = ((0, jsx_runtime_1.jsxs)(react_2.Flex, { as: "a", href: (_a = item.url) !== null && _a !== void 0 ? _a : "#", "data-group": "", "aria-current": isActive ? "page" : undefined, "aria-disabled": blocked ? true : undefined, textDecoration: "none", px: 2, py: "7px", mb: "2px", borderRadius: "lg", align: "center", justify: "space-between", gap: 2, overflow: "hidden", cursor: blocked ? "not-allowed" : "pointer", opacity: blocked ? 0.6 : 1, bg: isActive ? "whiteAlpha.300" : "transparent", _hover: {
|
|
63
|
+
bg: blocked ? "transparent" : isActive ? "whiteAlpha.400" : "whiteAlpha.200",
|
|
60
64
|
}, onClick: (e) => {
|
|
61
65
|
e.preventDefault();
|
|
62
|
-
if (!
|
|
66
|
+
if (!blocked)
|
|
63
67
|
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item);
|
|
64
|
-
}, borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", transition: "background 0.12s", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, flex: "1", minW: 0, overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, flexShrink: 0, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), (0, jsx_runtime_1.jsx)(react_2.Box, { flex: "1", minW: 0, children: (0, jsx_runtime_1.jsx)(OverflowTooltipText_1.default, { placement: "right", maxWidth: "100%", fontSize: itemFontSize, fontWeight: isActive ? 600 : 500, color: isActive ? activeAccent.label : theme.colors.white, _groupHover: isActive ? undefined : { color: theme.colors.white }, as: "p", children: item.title }) })] }), badgeVal != null && ((0, jsx_runtime_1.jsx)(react_2.Badge, { ...softBadge(theme.colors, colorScheme, (0, sidebarAccent_1.sidebarRowPeak)(theme.colors.sidebar.background[500])), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal }))] }));
|
|
68
|
+
}, borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", transition: "background 0.12s", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, flex: "1", minW: 0, overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, flexShrink: 0, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), (0, jsx_runtime_1.jsx)(react_2.Box, { flex: "1", minW: 0, children: (0, jsx_runtime_1.jsx)(OverflowTooltipText_1.default, { placement: "right", maxWidth: "100%", fontSize: itemFontSize, fontWeight: isActive ? 600 : 500, color: isActive ? activeAccent.label : theme.colors.white, _groupHover: isActive ? undefined : { color: theme.colors.white }, as: "p", children: item.title }) })] }), item.locked ? ((0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon })) : (badgeVal != null && ((0, jsx_runtime_1.jsx)(react_2.Badge, { ...softBadge(theme.colors, colorScheme, (0, sidebarAccent_1.sidebarRowPeak)(theme.colors.sidebar.background[500])), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal })))] }));
|
|
69
|
+
return item.locked && item.lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: item.lockedReason, placement: "top", children: row })) : (row);
|
|
65
70
|
};
|
|
66
71
|
const SecondaryBar = ({ items = [], defaultCollapsed = true, collapsedWidth = "3.5rem", expandedWidth = "10rem", headerFontSize = sidebarScale_1.SIDEBAR_ROW.fontSize, itemFontSize = sidebarScale_1.SIDEBAR_ROW.fontSize, selected, onItemClick, title, icon, }) => {
|
|
67
72
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
@@ -59,8 +59,10 @@ export type MenuProps = {
|
|
|
59
59
|
isDisabled?: boolean;
|
|
60
60
|
/** @deprecated Use `isDisabled` — renamed to match every other field. */
|
|
61
61
|
disabled?: boolean;
|
|
62
|
-
/**
|
|
62
|
+
/** Blocks the click handler/submenu expand and dims the row, same as `isDisabled`; also shows a lock icon. */
|
|
63
63
|
locked?: boolean;
|
|
64
|
+
/** Shown as a tooltip on hover/focus of a `locked` row (rail row, submenu row, and both flyouts). Ignored unless `locked` is true. */
|
|
65
|
+
lockedReason?: string;
|
|
64
66
|
/** Runtime also accepts a bare number/string (legacy shorthand) though the type only declares the object shape. */
|
|
65
67
|
badge?: {
|
|
66
68
|
/** Also triggers the small red dot on the icon when the rail is collapsed. */
|
|
@@ -1,10 +1,43 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const react_1 = require("react");
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
8
41
|
const react_2 = require("@chakra-ui/react");
|
|
9
42
|
const MenuPopoverContent_1 = __importDefault(require("./MenuPopoverContent"));
|
|
10
43
|
const menuDisabled_1 = require("../menuDisabled");
|
|
@@ -16,6 +49,7 @@ const sidebarAccent_1 = require("../../../Theme/tokens/builders/sidebarAccent");
|
|
|
16
49
|
const paletteFromTheme_1 = require("../../../Theme/chakra/paletteFromTheme");
|
|
17
50
|
const TextTruncation_1 = __importDefault(require("./TextTruncation"));
|
|
18
51
|
const sidebarId_1 = require("../sidebarId");
|
|
52
|
+
const ToolTip_1 = __importDefault(require("../../ToolTip/ToolTip"));
|
|
19
53
|
const sidebarScale_1 = require("../sidebarScale");
|
|
20
54
|
/**
|
|
21
55
|
* These rows are real `<a href>`s now, so the browser's own gestures have to keep working —
|
|
@@ -29,7 +63,7 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
|
|
|
29
63
|
const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
|
|
30
64
|
// Never the raw label — keeps this id unique across multiple mounted SideBars too.
|
|
31
65
|
const reactId = (0, sidebarId_1.sanitizeId)((0, react_1.useId)());
|
|
32
|
-
const { title, icon, locked, badge, subMenu, url } = menu;
|
|
66
|
+
const { title, icon, locked, lockedReason, badge, subMenu, url } = menu;
|
|
33
67
|
// `locked` blocks interaction the same as `disabled` — a locked item showing the padlock icon
|
|
34
68
|
// but still fully clickable was a real gotcha (see COMPONENT-GOTCHAS.md).
|
|
35
69
|
const isBlocked = (0, menuDisabled_1.menuDisabled)(menu) || locked;
|
|
@@ -115,12 +149,13 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
|
|
|
115
149
|
handleToggleSubMenu(e);
|
|
116
150
|
}, "data-menu-id": String((_c = menu.id) !== null && _c !== void 0 ? _c : title), children: buttonContent }) }), (0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsx)(react_2.PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", border: 'none', cursor: isBlocked ? "not-allowed" : "pointer", zIndex: 1500, children: (0, jsx_runtime_1.jsx)(react_2.PopoverBody, { p: "0.625rem", color: theme.colors.white, children: (0, jsx_runtime_1.jsx)(MenuPopoverContent_1.default, { menu: menu, handleMenuClick: handleClick, activeMenu: activeMenu }) }) }) })] }));
|
|
117
151
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
152
|
+
const row = ((0, jsx_runtime_1.jsx)(react_2.Box, { ...commonStyles, as: rowAs, type: hasSubMenu ? "button" : undefined, href: hasSubMenu ? undefined : url !== null && url !== void 0 ? url : "#", "aria-expanded": hasSubMenu ? !!isOpen : undefined, "aria-controls": hasSubMenu ? submenuPanelId : undefined, "aria-current": isAnyActive ? "page" : undefined, "aria-disabled": isBlocked ? true : undefined, onClick: (e) => {
|
|
153
|
+
if (!hasSubMenu && url && isBrowserNavigationGesture(e))
|
|
154
|
+
return;
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
handleToggleSubMenu(e);
|
|
157
|
+
}, "data-menu-id": String((_d = menu.id) !== null && _d !== void 0 ? _d : title), children: buttonContent }));
|
|
158
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [locked && lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: lockedReason, placement: "top", children: row })) : (row), hasSubMenu && ((0, jsx_runtime_1.jsx)(react_2.Collapse, { in: isOpen, animateOpacity: true, children: (0, jsx_runtime_1.jsx)(react_2.Box, { id: submenuPanelId, "data-collapse": "true", "data-menu-id": String((_e = menu.id) !== null && _e !== void 0 ? _e : title), "data-open": isOpen ? "true" : "false", mt: "0.125rem", sx: {
|
|
124
159
|
transition: "opacity 0.28s ease, transform 0.28s ease",
|
|
125
160
|
opacity: isOpen ? 1 : 0,
|
|
126
161
|
transform: isOpen ? "translateY(0)" : "translateY(-6px)",
|
|
@@ -128,7 +163,8 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
|
|
|
128
163
|
var _a, _b, _c;
|
|
129
164
|
const isSubActive = activeMenu === sub.id;
|
|
130
165
|
const isSubBlocked = (0, menuDisabled_1.menuDisabled)(sub) || sub.locked;
|
|
131
|
-
|
|
166
|
+
const subKey = `${String((_b = (_a = sub.id) !== null && _a !== void 0 ? _a : sub.title) !== null && _b !== void 0 ? _b : sIdx)}-${sIdx}`;
|
|
167
|
+
const subRow = ((0, jsx_runtime_1.jsxs)(react_2.Box, { as: "a", href: (_c = sub.url) !== null && _c !== void 0 ? _c : "#", "data-group": "", "aria-current": isSubActive ? "page" : undefined, "aria-disabled": isSubBlocked ? true : undefined, textDecoration: "none", h: sidebarScale_1.SIDEBAR_ROW.subHeight, pl: "28px", pr: "10px", borderRadius: "lg", fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, borderLeft: "2px solid", borderLeftColor: isSubActive ? theme.colors.sidebar.activeIcon : "transparent", backgroundColor: isSubActive ? "whiteAlpha.300" : "transparent", _hover: {
|
|
132
168
|
backgroundColor: isSubBlocked
|
|
133
169
|
? "transparent"
|
|
134
170
|
: isSubActive
|
|
@@ -153,7 +189,8 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
|
|
|
153
189
|
const variant = (_d = subCfg === null || subCfg === void 0 ? void 0 : subCfg.variant) !== null && _d !== void 0 ? _d : "subtle";
|
|
154
190
|
const tone = (0, tone_1.resolveSoftTone)(theme.colors, (0, paletteFromTheme_1.scaleFor)(theme.colors, colorScheme), (0, sidebarAccent_1.sidebarRowPeak)(theme.colors.sidebar.background[500]));
|
|
155
191
|
return ((0, jsx_runtime_1.jsx)(react_2.Badge, { bg: tone.bg, color: tone.fg, fontSize: "xs", variant: variant, borderRadius: radius, children: value }));
|
|
156
|
-
})()] }
|
|
192
|
+
})()] }));
|
|
193
|
+
return sub.locked && sub.lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: sub.lockedReason, placement: "top", children: subRow }, subKey)) : ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: subRow }, subKey));
|
|
157
194
|
}) }) }))] }));
|
|
158
195
|
};
|
|
159
196
|
exports.default = MenuItemBox;
|
|
@@ -13,12 +13,13 @@ const tone_1 = require("../../../Theme/tokens/builders/tone");
|
|
|
13
13
|
const sidebarAccent_1 = require("../../../Theme/tokens/builders/sidebarAccent");
|
|
14
14
|
const paletteFromTheme_1 = require("../../../Theme/chakra/paletteFromTheme");
|
|
15
15
|
const TextTruncation_1 = __importDefault(require("./TextTruncation"));
|
|
16
|
+
const ToolTip_1 = __importDefault(require("../../ToolTip/ToolTip"));
|
|
16
17
|
const sidebarScale_1 = require("../sidebarScale");
|
|
17
18
|
const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
|
|
18
19
|
var _a;
|
|
19
20
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
20
21
|
const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
|
|
21
|
-
const { title, icon, subMenu, badge, locked } = menu;
|
|
22
|
+
const { title, icon, subMenu, badge, locked, lockedReason } = menu;
|
|
22
23
|
const isBlocked = (0, menuDisabled_1.menuDisabled)(menu) || locked;
|
|
23
24
|
const hasSubMenu = !!(subMenu === null || subMenu === void 0 ? void 0 : subMenu.length);
|
|
24
25
|
const isParentActive = activeMenu === menu.id;
|
|
@@ -43,7 +44,7 @@ const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
|
|
|
43
44
|
const variant = (_d = cfg === null || cfg === void 0 ? void 0 : cfg.variant) !== null && _d !== void 0 ? _d : "subtle";
|
|
44
45
|
const tone = (0, tone_1.resolveSoftTone)(theme.colors, (0, paletteFromTheme_1.scaleFor)(theme.colors, colorScheme), (0, sidebarAccent_1.sidebarRowPeak)(theme.colors.sidebar.elevated));
|
|
45
46
|
return ((0, jsx_runtime_1.jsx)(react_1.Badge, { bg: tone.bg, color: tone.fg, fontSize: "xs", variant: variant, borderRadius: radius, children: value }));
|
|
46
|
-
})(), locked && (0, jsx_runtime_1.jsx)(react_1.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon })] }), subMenu === null || subMenu === void 0 ? void 0 : subMenu.map((sub) => {
|
|
47
|
+
})(), locked && (lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: lockedReason, placement: "top", children: (0, jsx_runtime_1.jsx)(react_1.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon }) })) : ((0, jsx_runtime_1.jsx)(react_1.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon })))] }), subMenu === null || subMenu === void 0 ? void 0 : subMenu.map((sub) => {
|
|
47
48
|
var _a;
|
|
48
49
|
const isSubActive = activeMenu === sub.id;
|
|
49
50
|
const isSubBlocked = (0, menuDisabled_1.menuDisabled)(sub) || sub.locked;
|
|
@@ -54,7 +55,7 @@ const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
|
|
|
54
55
|
}, px: 2, h: sidebarScale_1.SIDEBAR_ROW.subHeight, mb: "2px", borderRadius: "lg", align: "center", justify: "space-between", gap: 2, borderLeft: "2px solid", borderLeftColor: isSubActive ? theme.colors.sidebar.activeIcon : "transparent", bg: isSubActive ? "whiteAlpha.300" : "transparent", _hover: {
|
|
55
56
|
bg: isSubBlocked ? "transparent" : isSubActive ? "whiteAlpha.400" : "whiteAlpha.200",
|
|
56
57
|
cursor: !isSubBlocked ? "pointer" : "not-allowed",
|
|
57
|
-
}, opacity: isSubBlocked ? 0.5 : 1, pointerEvents: isSubBlocked ? "none" : "auto", transition: "background 0.12s", children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [sub.icon ? ((0, jsx_runtime_1.jsx)(react_1.Icon, { as: sub.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, flexShrink: 0, color: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" })) : ((0, jsx_runtime_1.jsx)(react_1.Box, { w: "5px", h: "5px", borderRadius: "full", flexShrink: 0, bg: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { bg: theme.colors.white }, transition: "background 0.12s" })), (0, jsx_runtime_1.jsx)(TextTruncation_1.default, { fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, fontWeight: isSubActive ? 600 : 500, flex: 1, color: isSubActive ? activeAccent.label : theme.colors.white, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, children: sub.title })] }), sub.locked ? ((0, jsx_runtime_1.jsx)(react_1.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon })) : (() => {
|
|
58
|
+
}, opacity: isSubBlocked ? 0.5 : 1, pointerEvents: isSubBlocked ? "none" : "auto", transition: "background 0.12s", children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [sub.icon ? ((0, jsx_runtime_1.jsx)(react_1.Icon, { as: sub.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, flexShrink: 0, color: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" })) : ((0, jsx_runtime_1.jsx)(react_1.Box, { w: "5px", h: "5px", borderRadius: "full", flexShrink: 0, bg: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { bg: theme.colors.white }, transition: "background 0.12s" })), (0, jsx_runtime_1.jsx)(TextTruncation_1.default, { fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, fontWeight: isSubActive ? 600 : 500, flex: 1, color: isSubActive ? activeAccent.label : theme.colors.white, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, children: sub.title })] }), sub.locked ? (sub.lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: sub.lockedReason, placement: "top", children: (0, jsx_runtime_1.jsx)(react_1.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon }) })) : ((0, jsx_runtime_1.jsx)(react_1.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon }))) : (() => {
|
|
58
59
|
var _a, _b, _c, _d;
|
|
59
60
|
const cfg = typeof sub.badge === "object" && sub.badge !== null
|
|
60
61
|
? sub.badge
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SpecTableProps } from "./SpecTableProps";
|
|
2
|
+
/** Definition list of specifications on striped tonal rows, with an optional "Show all" fold. */
|
|
3
|
+
declare const SpecTable: ({ items, columns, collapsedCount, expanded, defaultExpanded, onExpandedChange, labels, "aria-label": ariaLabel, "data-testid": testId, }: SpecTableProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
export default SpecTable;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 Button_1 = __importDefault(require("../Button/Button"));
|
|
11
|
+
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
12
|
+
const motion_1 = require("../../Theme/tokens/primitives/motion");
|
|
13
|
+
const motion_2 = require("../../Theme/chakra/motion");
|
|
14
|
+
const DEFAULT_LABELS = { showAll: "Show all", showLess: "Show less" };
|
|
15
|
+
/** Definition list of specifications on striped tonal rows, with an optional "Show all" fold. */
|
|
16
|
+
const SpecTable = ({ items, columns = 1, collapsedCount, expanded, defaultExpanded = false, onExpandedChange, labels, "aria-label": ariaLabel, "data-testid": testId, }) => {
|
|
17
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
18
|
+
const listId = (0, react_1.useId)();
|
|
19
|
+
const [inner, setInner] = (0, react_1.useState)(defaultExpanded);
|
|
20
|
+
const text = { ...DEFAULT_LABELS, ...labels };
|
|
21
|
+
if (items.length === 0)
|
|
22
|
+
return null;
|
|
23
|
+
const foldable = collapsedCount !== undefined && collapsedCount < items.length;
|
|
24
|
+
const isExpanded = expanded !== null && expanded !== void 0 ? expanded : inner;
|
|
25
|
+
const visible = foldable && !isExpanded ? items.slice(0, collapsedCount) : items;
|
|
26
|
+
const tint = colors.background[100];
|
|
27
|
+
const toggle = () => {
|
|
28
|
+
const next = !isExpanded;
|
|
29
|
+
if (expanded === undefined)
|
|
30
|
+
setInner(next);
|
|
31
|
+
onExpandedChange === null || onExpandedChange === void 0 ? void 0 : onExpandedChange(next);
|
|
32
|
+
};
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { "data-testid": testId, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { as: "dl", id: listId, m: 0, "aria-label": ariaLabel, display: "grid", gridTemplateColumns: columns === 2 ? { base: "1fr", md: "1fr 1fr" } : "1fr", borderRadius: "xl", overflow: "hidden", children: visible.map((item, i) => {
|
|
34
|
+
const stripeNarrow = i % 2 === 0;
|
|
35
|
+
const stripeWide = columns === 2 ? Math.floor(i / 2) % 2 === 0 : stripeNarrow;
|
|
36
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { "data-stripe": stripeNarrow, "data-stripe-wide": stripeWide, gap: 4, px: 4, py: 3, fontSize: "sm", bg: { base: stripeNarrow ? tint : "transparent", md: stripeWide ? tint : "transparent" }, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { as: "dt", flex: "0 0 40%", minW: 0, color: colors.textMuted, overflowWrap: "anywhere", children: item.label }), (0, jsx_runtime_1.jsx)(react_2.Box, { as: "dd", m: 0, flex: "1 1 0", minW: 0, fontWeight: 500, color: colors.header[900], overflowWrap: "anywhere", sx: { fontVariantNumeric: "tabular-nums" }, children: item.value })] }, `${item.label}-${i}`));
|
|
37
|
+
}) }), foldable && ((0, jsx_runtime_1.jsx)(react_2.Box, { mt: 2, children: (0, jsx_runtime_1.jsx)(Button_1.default, { variant: "ghost", size: "sm", "aria-expanded": isExpanded, "aria-controls": listId, onClick: toggle, rightIcon: (0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "inline-flex", transform: isExpanded ? "rotate(180deg)" : "rotate(0deg)", transition: (0, motion_1.transitionFor)(["transform"]), sx: (0, motion_2.reducedMotionSx)(), children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { size: 16, "aria-hidden": true }) }), children: isExpanded ? text.showLess : `${text.showAll} (${items.length})` }) }))] }));
|
|
38
|
+
};
|
|
39
|
+
exports.default = SpecTable;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** One label/value row. */
|
|
2
|
+
export interface SpecItem {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
/** Every string the table renders; override all of them for another language. */
|
|
7
|
+
export interface SpecTableLabels {
|
|
8
|
+
showAll: string;
|
|
9
|
+
showLess: string;
|
|
10
|
+
}
|
|
11
|
+
/** Definition list of specifications on striped tonal rows, with an optional "Show all" fold. */
|
|
12
|
+
export interface SpecTableProps {
|
|
13
|
+
items: SpecItem[];
|
|
14
|
+
/** 2 sits label and value side by side per row on wide screens and falls back to 1 on narrow ones. */
|
|
15
|
+
columns?: 1 | 2;
|
|
16
|
+
/** Rows shown before "Show all"; omit to show every row with no toggle. */
|
|
17
|
+
collapsedCount?: number;
|
|
18
|
+
/** Controlled expanded state; pair with `onExpandedChange`. */
|
|
19
|
+
expanded?: boolean;
|
|
20
|
+
defaultExpanded?: boolean;
|
|
21
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
22
|
+
labels?: Partial<SpecTableLabels>;
|
|
23
|
+
"aria-label"?: string;
|
|
24
|
+
"data-testid"?: string;
|
|
25
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SpinnerProps } from "./SpinnerProps";
|
|
2
2
|
/** Themed spinner for inline or panel loading; for a blocking overlay use Loading, for a button use Button isLoading. */
|
|
3
|
-
export default function Spinner({ size, tone, color, label, thickness, speed, emptyColor, sx, ...rest }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default function Spinner({ size, tone, color, label, thickness, speed, emptyColor, sx, testId, ...rest }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,9 +14,9 @@ const SPINNER_SIZES = {
|
|
|
14
14
|
xl: { boxSize: "3rem", thickness: "0.25rem" },
|
|
15
15
|
};
|
|
16
16
|
/** Themed spinner for inline or panel loading; for a blocking overlay use Loading, for a button use Button isLoading. */
|
|
17
|
-
function Spinner({ size = "md", tone, color, label = "Loading", thickness, speed = "0.7s", emptyColor = "transparent", sx, ...rest }) {
|
|
17
|
+
function Spinner({ size = "md", tone, color, label = "Loading", thickness, speed = "0.7s", emptyColor = "transparent", sx, testId, ...rest }) {
|
|
18
18
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
19
19
|
const spec = SPINNER_SIZES[size];
|
|
20
20
|
const ink = color !== null && color !== void 0 ? color : (tone ? (0, tone_1.toneInk)(colors, tone) : colors.accentText);
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Spinner, { boxSize: spec.boxSize, ...rest, label: label, color: ink, emptyColor: emptyColor, thickness: thickness !== null && thickness !== void 0 ? thickness : spec.thickness, speed: speed, sx: { [motion_1.REDUCED_MOTION_QUERY]: { animationDuration: "1.6s" }, ...sx } }));
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Spinner, { boxSize: spec.boxSize, ...rest, label: label, color: ink, emptyColor: emptyColor, thickness: thickness !== null && thickness !== void 0 ? thickness : spec.thickness, speed: speed, sx: { [motion_1.REDUCED_MOTION_QUERY]: { animationDuration: "1.6s" }, ...sx }, ...(testId !== undefined ? { "data-testid": testId } : {}) }));
|
|
22
22
|
}
|
|
@@ -12,4 +12,6 @@ export type SpinnerProps = Omit<ChakraSpinnerProps, "size"> & {
|
|
|
12
12
|
color?: string;
|
|
13
13
|
/** Screen-reader text; defaults to "Loading". */
|
|
14
14
|
label?: string;
|
|
15
|
+
/** data-testid for the rendered node; wins over a raw `data-testid` passthrough. */
|
|
16
|
+
testId?: string;
|
|
15
17
|
};
|
|
@@ -21,8 +21,9 @@ const StepperStage = ({ label, number, state, size = "md", colorScheme = "primar
|
|
|
21
21
|
const s = sizeMap[size];
|
|
22
22
|
const interactive = !isReadOnly && !disabled;
|
|
23
23
|
(0, react_1.useEffect)(() => {
|
|
24
|
+
var _a, _b;
|
|
24
25
|
if (state === "active" && scrollIntoViewWhenActive && ref.current) {
|
|
25
|
-
ref.current.scrollIntoView({
|
|
26
|
+
(_b = (_a = ref.current).scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
26
27
|
behavior: "smooth",
|
|
27
28
|
inline: "center",
|
|
28
29
|
block: "nearest",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { StatCardProps } from "./StatCardProps";
|
|
2
2
|
/** KPI tile: tinted icon chip, label, 2xl tabular value, delta coloured by whether the change is good. */
|
|
3
|
-
declare const StatCard: ({ label, value, delta, trend, goodDirection, hint, icon: Icon, isLoading, onClick, "aria-label": ariaLabel, "data-testid": testId, }: StatCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const StatCard: ({ label, value, delta, trend, goodDirection, hint, sparkline, footer, icon: Icon, isLoading, onClick, "aria-label": ariaLabel, "data-testid": testId, }: StatCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default StatCard;
|
|
@@ -13,7 +13,7 @@ const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
|
|
|
13
13
|
const Skeletons_1 = __importDefault(require("../Skeletons/Skeletons"));
|
|
14
14
|
const StatCardSkeleton = ({ hasIcon }) => ((0, jsx_runtime_1.jsxs)(react_1.Flex, { direction: "column", gap: 3, children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: 2, children: [hasIcon && (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: 8, width: 8 }), (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: 3, width: "40%" })] }), (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: 7, width: "55%" }), (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: 3, width: "45%" })] }));
|
|
15
15
|
/** KPI tile: tinted icon chip, label, 2xl tabular value, delta coloured by whether the change is good. */
|
|
16
|
-
const StatCard = ({ label, value, delta, trend, goodDirection = "up", hint, icon: Icon, isLoading = false, onClick, "aria-label": ariaLabel, "data-testid": testId, }) => {
|
|
16
|
+
const StatCard = ({ label, value, delta, trend, goodDirection = "up", hint, sparkline, footer, icon: Icon, isLoading = false, onClick, "aria-label": ariaLabel, "data-testid": testId, }) => {
|
|
17
17
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
18
18
|
const isInteractive = !!onClick && !isLoading;
|
|
19
19
|
const deltaColor = trend
|
|
@@ -33,7 +33,7 @@ const StatCard = ({ label, value, delta, trend, goodDirection = "up", hint, icon
|
|
|
33
33
|
px: 5,
|
|
34
34
|
py: 4,
|
|
35
35
|
};
|
|
36
|
-
const content = isLoading ? ((0, jsx_runtime_1.jsx)(StatCardSkeleton, { hasIcon: !!Icon })) : ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", direction: "column", gap: 3, children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", gap: 2, children: [Icon && ((0, jsx_runtime_1.jsx)(react_1.Flex, { as: "span", boxSize: 8, flexShrink: 0, align: "center", justify: "center", borderRadius: "lg", bg: colors.primary.opacity[8], color: colors.accentText, children: (0, jsx_runtime_1.jsx)(Icon, { size: 16, "aria-hidden": true }) })), (0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", fontSize: "xs", fontWeight: 500, color: colors.textMuted, children: label })] }), (0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", display: "block", fontSize: "2xl", fontWeight: 700, letterSpacing: "-0.02em", lineHeight: "short", color: colors.header[900], sx: { fontVariantNumeric: "tabular-nums" }, children: value }), (delta !== undefined || hint) && ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", gap: 1.5, wrap: "wrap", children: [delta !== undefined && ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", gap: 0.5, color: deltaColor, "data-testid": "stat-delta", children: [trend && (0, jsx_runtime_1.jsx)(DeltaIcon, { size: 14, "aria-hidden": true }), trend && (0, jsx_runtime_1.jsx)(react_1.VisuallyHidden, { children: trend === "up" ? "Up" : "Down" }), (0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", fontSize: "xs", fontWeight: 600, sx: { fontVariantNumeric: "tabular-nums" }, children: delta })] })), hint && ((0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", fontSize: "xs", color: colors.textMuted, children: hint }))] }))] }));
|
|
36
|
+
const content = isLoading ? ((0, jsx_runtime_1.jsx)(StatCardSkeleton, { hasIcon: !!Icon })) : ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", direction: "column", gap: 3, children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", gap: 2, children: [Icon && ((0, jsx_runtime_1.jsx)(react_1.Flex, { as: "span", boxSize: 8, flexShrink: 0, align: "center", justify: "center", borderRadius: "lg", bg: colors.primary.opacity[8], color: colors.accentText, children: (0, jsx_runtime_1.jsx)(Icon, { size: 16, "aria-hidden": true }) })), (0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", fontSize: "xs", fontWeight: 500, color: colors.textMuted, children: label })] }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", justify: "space-between", gap: 3, children: [(0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", display: "block", fontSize: "2xl", fontWeight: 700, letterSpacing: "-0.02em", lineHeight: "short", color: colors.header[900], sx: { fontVariantNumeric: "tabular-nums" }, children: value }), sparkline && ((0, jsx_runtime_1.jsx)(react_1.Flex, { as: "span", align: "center", justify: "center", flexShrink: 0, h: 8, minW: 16, maxW: 24, overflow: "hidden", "data-testid": "stat-sparkline", children: sparkline }))] }), (delta !== undefined || hint) && ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", gap: 1.5, wrap: "wrap", children: [delta !== undefined && ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", gap: 0.5, color: deltaColor, "data-testid": "stat-delta", children: [trend && (0, jsx_runtime_1.jsx)(DeltaIcon, { size: 14, "aria-hidden": true }), trend && (0, jsx_runtime_1.jsx)(react_1.VisuallyHidden, { children: trend === "up" ? "Up" : "Down" }), (0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", fontSize: "xs", fontWeight: 600, sx: { fontVariantNumeric: "tabular-nums" }, children: delta })] })), hint && ((0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", fontSize: "xs", color: colors.textMuted, children: hint }))] })), footer && ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "span", pt: 3, borderTopWidth: "1px", borderColor: colors.boxborder[200], "data-testid": "stat-footer", children: footer }))] }));
|
|
37
37
|
if (!isInteractive) {
|
|
38
38
|
return ((0, jsx_runtime_1.jsx)(react_1.Box, { ...surface, "aria-busy": isLoading || undefined, "data-testid": testId, children: content }));
|
|
39
39
|
}
|
|
@@ -13,6 +13,10 @@ export interface StatCardProps {
|
|
|
13
13
|
goodDirection?: StatTrend;
|
|
14
14
|
/** Muted text beside the delta, e.g. "vs last month". */
|
|
15
15
|
hint?: ReactNode;
|
|
16
|
+
/** Small inline trend chart rendered beside the value, e.g. a sparkline SVG; bring your own — this only sizes/positions the slot (max 96px wide, 32px tall). */
|
|
17
|
+
sparkline?: ReactNode;
|
|
18
|
+
/** Content pinned to the bottom of the card below a divider, e.g. a "View details" link. */
|
|
19
|
+
footer?: ReactNode;
|
|
16
20
|
/** Icon component (not an element) shown in a tinted chip before the label. */
|
|
17
21
|
icon?: ElementType;
|
|
18
22
|
/** Shows a skeleton and disables the click target. */
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { StickyBuyBarProps } from "./StickyBuyBarProps";
|
|
2
|
+
declare const StickyBuyBar: ({ price, mrp, mode, visible, position, isLoading, quantity, onQuantityChange, maxQuantity, onAddToBag, onSelectOption, onNotify, onGoToBag, onBuyNow, itemLabel, currency, locale, labels, "data-testid": testId, }: StickyBuyBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default StickyBuyBar;
|
|
@@ -0,0 +1,85 @@
|
|
|
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("@chakra-ui/react");
|
|
8
|
+
const react_2 = require("@emotion/react");
|
|
9
|
+
const lucide_react_1 = require("lucide-react");
|
|
10
|
+
const Button_1 = __importDefault(require("../Button/Button"));
|
|
11
|
+
const PriceBlock_1 = __importDefault(require("../PriceBlock/PriceBlock"));
|
|
12
|
+
const QuantityStepper_1 = __importDefault(require("../QuantityStepper/QuantityStepper"));
|
|
13
|
+
const glass_1 = require("../MediaGallery/glass");
|
|
14
|
+
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
15
|
+
const motion_1 = require("../../Theme/tokens/primitives/motion");
|
|
16
|
+
const zIndices_1 = __importDefault(require("../../Theme/tokens/primitives/zIndices"));
|
|
17
|
+
const motion_2 = require("../../Theme/chakra/motion");
|
|
18
|
+
const DEFAULT_LABELS = {
|
|
19
|
+
region: "Buy",
|
|
20
|
+
add: "Add to bag",
|
|
21
|
+
selectOption: "Select an option",
|
|
22
|
+
notify: "Notify me",
|
|
23
|
+
added: "Added",
|
|
24
|
+
goToBag: "Go to bag",
|
|
25
|
+
buyNow: "Buy now",
|
|
26
|
+
adding: "Adding to bag",
|
|
27
|
+
};
|
|
28
|
+
const SLIDE_MS = 240;
|
|
29
|
+
const BAR_HEIGHT = "3.25rem";
|
|
30
|
+
const SLOT_MIN_WIDTH = "9.5rem";
|
|
31
|
+
const RISE = "6px";
|
|
32
|
+
const NO_BLUR_SUPPORT = "@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)))";
|
|
33
|
+
const SAFE_BOTTOM = "calc(0.75rem + env(safe-area-inset-bottom, 0px))";
|
|
34
|
+
const pop = (0, react_2.keyframes) `0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); }`;
|
|
35
|
+
const STACK_ORDER = ["add", "select-option", "notify", "added", "go-to-bag"];
|
|
36
|
+
const StickyBuyBar = ({ price, mrp, mode = "add", visible = true, position = "sticky", isLoading = false, quantity, onQuantityChange, maxQuantity, onAddToBag, onSelectOption, onNotify, onGoToBag, onBuyNow, itemLabel, currency, locale, labels, "data-testid": testId, }) => {
|
|
37
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
38
|
+
const reduced = (0, motion_2.usePrefersReducedMotion)();
|
|
39
|
+
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
40
|
+
const glass = (0, glass_1.glassStyles)(colors);
|
|
41
|
+
const stepping = mode === "stepper";
|
|
42
|
+
const active = stepping ? null : mode;
|
|
43
|
+
const text = {
|
|
44
|
+
add: copy.add,
|
|
45
|
+
"select-option": copy.selectOption,
|
|
46
|
+
notify: copy.notify,
|
|
47
|
+
added: copy.added,
|
|
48
|
+
"go-to-bag": copy.goToBag,
|
|
49
|
+
};
|
|
50
|
+
const handlers = {
|
|
51
|
+
add: onAddToBag,
|
|
52
|
+
"select-option": onSelectOption,
|
|
53
|
+
notify: onNotify,
|
|
54
|
+
added: undefined,
|
|
55
|
+
"go-to-bag": onGoToBag,
|
|
56
|
+
};
|
|
57
|
+
const tonal = mode === "notify";
|
|
58
|
+
const inert = mode === "added" || isLoading;
|
|
59
|
+
// NOTE: Button's prop type is a closed Pick, so aria-busy / aria-disabled ride in on a spread.
|
|
60
|
+
const aria = {
|
|
61
|
+
"aria-busy": isLoading ? "true" : undefined,
|
|
62
|
+
"aria-disabled": inert ? "true" : undefined,
|
|
63
|
+
"aria-label": isLoading ? copy.adding : undefined,
|
|
64
|
+
};
|
|
65
|
+
const layer = (on) => ({
|
|
66
|
+
gridArea: "1 / 1",
|
|
67
|
+
opacity: on ? 1 : 0,
|
|
68
|
+
visibility: on ? "visible" : "hidden",
|
|
69
|
+
transition: reduced ? "none" : `${(0, motion_1.transitionFor)(["opacity"])}, visibility 0s linear ${on ? 0 : 150}ms`,
|
|
70
|
+
});
|
|
71
|
+
const label = (key) => {
|
|
72
|
+
const on = key === active;
|
|
73
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", "aria-hidden": on ? undefined : true, gridArea: "1 / 1", align: "center", justify: "center", gap: 1.5, opacity: on ? 1 : 0, transform: on || reduced ? "none" : `translateY(${RISE})`, transition: (0, motion_1.transitionFor)(["opacity", "transform"]), sx: (0, motion_2.reducedMotionSx)(), children: [key === "added" && ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "span", display: "inline-flex", animation: on && !reduced ? `${pop} 280ms ${motion_1.MOTION_EASE} both` : undefined, sx: (0, motion_2.reducedMotionSx)(), children: (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { size: 18, "aria-hidden": true }) })), text[key]] }, key));
|
|
74
|
+
};
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "section", role: "region", "aria-label": copy.region, "aria-hidden": visible ? undefined : true, position: position === "sticky" ? "sticky" : "relative", bottom: position === "sticky" ? 0 : undefined, zIndex: zIndices_1.default.sticky, px: 4, pt: 3, pb: SAFE_BOTTOM, transform: visible ? "translateY(0)" : "translateY(100%)", visibility: visible ? "visible" : "hidden", transition: reduced ? "none" : `transform ${SLIDE_MS}ms ${motion_1.MOTION_EASE}, visibility 0s linear ${visible ? 0 : SLIDE_MS}ms`, "data-testid": testId, ...glass, sx: { ...glass.sx, [NO_BLUR_SUPPORT]: { backgroundColor: colors.surfaceRaised }, ...(0, motion_2.reducedMotionSx)() }, children: (0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: 3, children: [(0, jsx_runtime_1.jsx)(react_1.Box, { flex: 1, minW: 0, children: (0, jsx_runtime_1.jsx)(PriceBlock_1.default, { size: "sm", price: price, mrp: mrp, currency: currency, locale: locale }) }), mode === "add" && onBuyNow && ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: "outline", size: "lg", h: BAR_HEIGHT, onClick: onBuyNow, label: copy.buyNow })), (0, jsx_runtime_1.jsxs)(react_1.Grid, { minW: SLOT_MIN_WIDTH, justifyItems: "stretch", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_1.Box, { ...layer(!stepping), "aria-hidden": stepping ? true : undefined, children: (0, jsx_runtime_1.jsx)(Button_1.default, { ...aria, variant: tonal ? "ghost" : "solid", size: "lg", w: "100%", h: BAR_HEIGHT, onClick: () => {
|
|
76
|
+
var _a;
|
|
77
|
+
if (!inert)
|
|
78
|
+
(_a = handlers[mode]) === null || _a === void 0 ? void 0 : _a.call(handlers);
|
|
79
|
+
}, sx: {
|
|
80
|
+
...(tonal ? { bg: colors.background[100], color: colors.header[900], _hover: { bg: colors.background[200] } } : {}),
|
|
81
|
+
...(inert ? { cursor: isLoading ? "progress" : "default", pointerEvents: isLoading ? "auto" : "none" } : {}),
|
|
82
|
+
display: "grid",
|
|
83
|
+
}, children: STACK_ORDER.map(label) }) }), (0, jsx_runtime_1.jsx)(react_1.Flex, { ...layer(stepping), "aria-hidden": stepping ? undefined : true, justify: "center", align: "center", h: BAR_HEIGHT, children: (0, jsx_runtime_1.jsx)(QuantityStepper_1.default, { value: quantity, onValueChange: onQuantityChange, max: maxQuantity, itemLabel: itemLabel, size: "md" }) })] })] }) }));
|
|
84
|
+
};
|
|
85
|
+
exports.default = StickyBuyBar;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { PriceFormat } from "../Commerce/commerceTypes";
|
|
2
|
+
/** What the primary slot does: add, prompt for an option, notify, confirm an add, go to the bag, or edit the quantity in place. */
|
|
3
|
+
export type StickyBuyBarMode = "add" | "select-option" | "notify" | "added" | "go-to-bag" | "stepper";
|
|
4
|
+
/** `sticky` pins to the viewport bottom inside its scroll parent; `static` flows with the page, e.g. inside a phone frame. */
|
|
5
|
+
export type StickyBuyBarPosition = "sticky" | "static";
|
|
6
|
+
/** Every string the bar renders; override all of them for another language. */
|
|
7
|
+
export interface StickyBuyBarLabels {
|
|
8
|
+
/** Accessible name of the landmark region. */
|
|
9
|
+
region: string;
|
|
10
|
+
add: string;
|
|
11
|
+
/** Prompt shown when an option is still unpicked, e.g. "Select a size". */
|
|
12
|
+
selectOption: string;
|
|
13
|
+
notify: string;
|
|
14
|
+
/** Short confirmation in the button while mode is `added`. */
|
|
15
|
+
added: string;
|
|
16
|
+
goToBag: string;
|
|
17
|
+
buyNow: string;
|
|
18
|
+
/** Screen-reader name of the busy button while `isLoading`. */
|
|
19
|
+
adding: string;
|
|
20
|
+
}
|
|
21
|
+
/** Mobile bottom bar: price on the left, one primary action on the right; the parent decides when it is `visible`. */
|
|
22
|
+
export interface StickyBuyBarProps extends PriceFormat {
|
|
23
|
+
/** Selling price of the selected variant. */
|
|
24
|
+
price: number;
|
|
25
|
+
/** List price; the strike and discount only render when it is above `price`. */
|
|
26
|
+
mrp?: number;
|
|
27
|
+
/** State of the primary slot; the width never changes between states. */
|
|
28
|
+
mode?: StickyBuyBarMode;
|
|
29
|
+
/** Controlled: slides in when true and out when false, and is removed from the tab order while out. Typically driven by an IntersectionObserver on the inline CTA. */
|
|
30
|
+
visible?: boolean;
|
|
31
|
+
position?: StickyBuyBarPosition;
|
|
32
|
+
/** Marks the primary as busy (aria-busy) and ignores further taps. */
|
|
33
|
+
isLoading?: boolean;
|
|
34
|
+
/** `stepper` mode only: current quantity. */
|
|
35
|
+
quantity?: number;
|
|
36
|
+
/** `stepper` mode only: fires with the new quantity. */
|
|
37
|
+
onQuantityChange?: (quantity: number) => void;
|
|
38
|
+
/** `stepper` mode only: ceiling, e.g. the variant's remaining stock. */
|
|
39
|
+
maxQuantity?: number;
|
|
40
|
+
/** Fires on the primary in `add` mode. */
|
|
41
|
+
onAddToBag?: () => void;
|
|
42
|
+
/** Fires on the primary in `select-option` mode; the page should scroll the selector into view. */
|
|
43
|
+
onSelectOption?: () => void;
|
|
44
|
+
/** Fires on the primary in `notify` mode. */
|
|
45
|
+
onNotify?: () => void;
|
|
46
|
+
/** Fires on the primary in `go-to-bag` mode. */
|
|
47
|
+
onGoToBag?: () => void;
|
|
48
|
+
/** Adds a secondary "Buy now" beside the primary in `add` mode when provided. */
|
|
49
|
+
onBuyNow?: () => void;
|
|
50
|
+
/** Product name, so the stepper reads "Quantity of Slim-Fit Denim Jacket". */
|
|
51
|
+
itemLabel?: string;
|
|
52
|
+
labels?: Partial<StickyBuyBarLabels>;
|
|
53
|
+
"data-testid"?: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StockStatusProps } from "./StockStatusProps";
|
|
2
|
+
/** Availability dot + label for a `StockState`; colour comes from `semanticText`, meaning from the words. */
|
|
3
|
+
declare const StockStatus: ({ status, count, message, size, "data-testid": testId }: StockStatusProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default StockStatus;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("@chakra-ui/react");
|
|
5
|
+
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
6
|
+
const TEXT_SIZE = { sm: "xs", md: "sm" };
|
|
7
|
+
const DOT_PX = { sm: 6, md: 8 };
|
|
8
|
+
const defaultMessage = (status, count) => {
|
|
9
|
+
switch (status) {
|
|
10
|
+
case "in-stock":
|
|
11
|
+
return "In stock";
|
|
12
|
+
case "low-stock":
|
|
13
|
+
return count !== undefined ? `Only ${count} left` : "Low stock";
|
|
14
|
+
case "out-of-stock":
|
|
15
|
+
return "Out of stock";
|
|
16
|
+
case "backorder":
|
|
17
|
+
return "Available on backorder";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
/** Availability dot + label for a `StockState`; colour comes from `semanticText`, meaning from the words. */
|
|
21
|
+
const StockStatus = ({ status, count, message, size = "md", "data-testid": testId }) => {
|
|
22
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
23
|
+
const ink = {
|
|
24
|
+
"in-stock": colors.semanticText.success,
|
|
25
|
+
"low-stock": colors.semanticText.warning,
|
|
26
|
+
"out-of-stock": colors.textMuted,
|
|
27
|
+
backorder: colors.semanticText.info,
|
|
28
|
+
};
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", display: "inline-flex", align: "center", gap: 1.5, "data-status": status, "data-testid": testId, color: ink[status], children: [(0, jsx_runtime_1.jsx)(react_1.Box, { as: "span", "aria-hidden": true, boxSize: `${DOT_PX[size]}px`, flexShrink: 0, borderRadius: "full", bg: "currentColor" }), (0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", fontSize: TEXT_SIZE[size], fontWeight: 600, lineHeight: 1.4, children: message !== null && message !== void 0 ? message : defaultMessage(status, count) })] }));
|
|
30
|
+
};
|
|
31
|
+
exports.default = StockStatus;
|