pixelize-design-library 2.4.2-beta.56 → 2.4.2-beta.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -0
- package/COMPONENT-GOTCHAS.md +48 -20
- package/DESIGN-GUIDE.md +18 -1
- package/dist/Components/AddressCard/AddressCard.d.ts +4 -0
- package/dist/Components/AddressCard/AddressCard.js +25 -0
- package/dist/Components/AddressCard/AddressCardGroup.d.ts +4 -0
- package/dist/Components/AddressCard/AddressCardGroup.js +7 -0
- package/dist/Components/AddressCard/AddressCardProps.d.ts +43 -0
- package/dist/Components/AddressCard/AddressCardProps.js +2 -0
- package/dist/Components/BagBar/BagBar.d.ts +4 -0
- package/dist/Components/BagBar/BagBar.js +32 -0
- package/dist/Components/BagBar/BagBarProps.d.ts +30 -0
- package/dist/Components/BagBar/BagBarProps.js +2 -0
- package/dist/Components/CartItem/CartItem.d.ts +4 -0
- package/dist/Components/CartItem/CartItem.js +60 -0
- package/dist/Components/CartItem/CartItemProps.d.ts +64 -0
- package/dist/Components/CartItem/CartItemProps.js +2 -0
- package/dist/Components/CartItem/cartItemOptions.d.ts +3 -0
- package/dist/Components/CartItem/cartItemOptions.js +13 -0
- package/dist/Components/CheckoutKit/selectable.d.ts +58 -0
- package/dist/Components/CheckoutKit/selectable.js +120 -0
- package/dist/Components/Commerce/commerceTypes.d.ts +52 -0
- package/dist/Components/Commerce/commerceTypes.js +2 -0
- package/dist/Components/Commerce/commerceVariants.d.ts +13 -0
- package/dist/Components/Commerce/commerceVariants.js +51 -0
- package/dist/Components/Commerce/index.d.ts +2 -0
- package/dist/Components/Commerce/index.js +18 -0
- package/dist/Components/Commerce/useContainerWidth.d.ts +3 -0
- package/dist/Components/Commerce/useContainerWidth.js +25 -0
- package/dist/Components/CouponField/CouponField.d.ts +4 -0
- package/dist/Components/CouponField/CouponField.js +72 -0
- package/dist/Components/CouponField/CouponFieldProps.d.ts +49 -0
- package/dist/Components/CouponField/CouponFieldProps.js +2 -0
- package/dist/Components/DatePicker/PickerPortal.d.ts +11 -0
- package/dist/Components/DatePicker/PickerPortal.js +26 -0
- package/dist/Components/DatePicker/RangeDatePicker.d.ts +1 -1
- package/dist/Components/DatePicker/RangeDatePicker.js +67 -32
- package/dist/Components/DatePicker/SingleDatePicker.js +49 -13
- package/dist/Components/DatePicker/TimeOnlyPicker.js +39 -4
- package/dist/Components/DetailSections/DetailSections.d.ts +4 -0
- package/dist/Components/DetailSections/DetailSections.js +112 -0
- package/dist/Components/DetailSections/DetailSectionsProps.d.ts +58 -0
- package/dist/Components/DetailSections/DetailSectionsProps.js +2 -0
- package/dist/Components/MediaGallery/MediaFrame.d.ts +31 -0
- package/dist/Components/MediaGallery/MediaFrame.js +55 -0
- package/dist/Components/MediaGallery/MediaGallery.d.ts +4 -0
- package/dist/Components/MediaGallery/MediaGallery.js +206 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.d.ts +76 -0
- package/dist/Components/MediaGallery/MediaGalleryProps.js +20 -0
- package/dist/Components/MediaGallery/MediaLightbox.d.ts +4 -0
- package/dist/Components/MediaGallery/MediaLightbox.js +116 -0
- package/dist/Components/MediaGallery/MediaLightboxProps.d.ts +40 -0
- package/dist/Components/MediaGallery/MediaLightboxProps.js +15 -0
- package/dist/Components/MediaGallery/MediaThumb.d.ts +18 -0
- package/dist/Components/MediaGallery/MediaThumb.js +25 -0
- package/dist/Components/MediaGallery/glass.d.ts +31 -0
- package/dist/Components/MediaGallery/glass.js +47 -0
- package/dist/Components/MediaGallery/mediaGalleryModel.d.ts +22 -0
- package/dist/Components/MediaGallery/mediaGalleryModel.js +83 -0
- package/dist/Components/MediaGallery/motion.d.ts +5 -0
- package/dist/Components/MediaGallery/motion.js +12 -0
- package/dist/Components/MediaGallery/useMatchMedia.d.ts +2 -0
- package/dist/Components/MediaGallery/useMatchMedia.js +20 -0
- package/dist/Components/OffersList/OffersList.d.ts +4 -0
- package/dist/Components/OffersList/OffersList.js +83 -0
- package/dist/Components/OffersList/OffersListProps.d.ts +34 -0
- package/dist/Components/OffersList/OffersListProps.js +2 -0
- package/dist/Components/OptionChip/OptionChip.d.ts +4 -0
- package/dist/Components/OptionChip/OptionChip.js +97 -0
- package/dist/Components/OptionChip/OptionChipProps.d.ts +33 -0
- package/dist/Components/OptionChip/OptionChipProps.js +2 -0
- package/dist/Components/OptionChip/optionInk.d.ts +12 -0
- package/dist/Components/OptionChip/optionInk.js +25 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.d.ts +4 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.js +57 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.d.ts +29 -0
- package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +2 -0
- package/dist/Components/OrderSummary/OrderSummary.d.ts +4 -0
- package/dist/Components/OrderSummary/OrderSummary.js +63 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.d.ts +53 -0
- package/dist/Components/OrderSummary/OrderSummaryProps.js +2 -0
- package/dist/Components/PaymentOption/PaymentOption.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOption.js +24 -0
- package/dist/Components/PaymentOption/PaymentOptionGroup.d.ts +4 -0
- package/dist/Components/PaymentOption/PaymentOptionGroup.js +7 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.d.ts +32 -0
- package/dist/Components/PaymentOption/PaymentOptionProps.js +2 -0
- package/dist/Components/PincodeChecker/PincodeChecker.d.ts +4 -0
- package/dist/Components/PincodeChecker/PincodeChecker.js +175 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.d.ts +57 -0
- package/dist/Components/PincodeChecker/PincodeCheckerProps.js +2 -0
- package/dist/Components/PriceBlock/PriceBlock.d.ts +4 -0
- package/dist/Components/PriceBlock/PriceBlock.js +41 -0
- package/dist/Components/PriceBlock/PriceBlockProps.d.ts +39 -0
- package/dist/Components/PriceBlock/PriceBlockProps.js +2 -0
- package/dist/Components/ProductBadges/ProductBadges.d.ts +4 -0
- package/dist/Components/ProductBadges/ProductBadges.js +61 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.d.ts +18 -0
- package/dist/Components/ProductBadges/ProductBadgesProps.js +2 -0
- package/dist/Components/ProductCard/ProductCard.d.ts +3 -2
- package/dist/Components/ProductCard/ProductCard.js +103 -52
- package/dist/Components/ProductCard/ProductCardAction.d.ts +17 -0
- package/dist/Components/ProductCard/ProductCardAction.js +65 -0
- package/dist/Components/ProductCard/ProductCardGrid.d.ts +4 -0
- package/dist/Components/ProductCard/ProductCardGrid.js +20 -0
- package/dist/Components/ProductCard/ProductCardMedia.d.ts +18 -0
- package/dist/Components/ProductCard/ProductCardMedia.js +35 -0
- package/dist/Components/ProductCard/ProductCardProps.d.ts +138 -56
- package/dist/Components/ProductCard/ProductCardSkeleton.d.ts +4 -0
- package/dist/Components/ProductCard/ProductCardSkeleton.js +17 -0
- package/dist/Components/ProductCard/ProductCardSwatches.d.ts +15 -0
- package/dist/Components/ProductCard/ProductCardSwatches.js +37 -0
- package/dist/Components/ProductCard/QuickAddSheet.d.ts +4 -0
- package/dist/Components/ProductCard/QuickAddSheet.js +109 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.d.ts +38 -0
- package/dist/Components/ProductCard/QuickAddSheetProps.js +2 -0
- package/dist/Components/ProductCard/cardLabels.d.ts +2 -0
- package/dist/Components/ProductCard/cardLabels.js +16 -0
- package/dist/Components/ProductCard/cardMetrics.d.ts +27 -0
- package/dist/Components/ProductCard/cardMetrics.js +55 -0
- package/dist/Components/ProductCard/productCardFixtures.d.ts +7 -0
- package/dist/Components/ProductCard/productCardFixtures.js +61 -0
- package/dist/Components/ProductCard/productCardModel.d.ts +22 -0
- package/dist/Components/ProductCard/productCardModel.js +79 -0
- package/dist/Components/ProductCard/useMinWidth.d.ts +2 -0
- package/dist/Components/ProductCard/useMinWidth.js +20 -0
- package/dist/Components/ProductDetails/ProductDetails.d.ts +3 -2
- package/dist/Components/ProductDetails/ProductDetails.js +209 -33
- package/dist/Components/ProductDetails/ProductDetailsProps.d.ts +143 -41
- package/dist/Components/ProductDetails/productDetailsModel.d.ts +14 -0
- package/dist/Components/ProductDetails/productDetailsModel.js +45 -0
- package/dist/Components/ProductDetails/useInViewport.d.ts +3 -0
- package/dist/Components/ProductDetails/useInViewport.js +18 -0
- package/dist/Components/QuantityStepper/QuantityStepper.d.ts +4 -0
- package/dist/Components/QuantityStepper/QuantityStepper.js +59 -0
- package/dist/Components/QuantityStepper/QuantityStepperProps.d.ts +24 -0
- package/dist/Components/QuantityStepper/QuantityStepperProps.js +2 -0
- package/dist/Components/Rating/Rating.d.ts +4 -0
- package/dist/Components/Rating/Rating.js +81 -0
- package/dist/Components/Rating/RatingProps.d.ts +27 -0
- package/dist/Components/Rating/RatingProps.js +2 -0
- package/dist/Components/ReviewList/ReviewList.d.ts +4 -0
- package/dist/Components/ReviewList/ReviewList.js +94 -0
- package/dist/Components/ReviewList/ReviewListProps.d.ts +68 -0
- package/dist/Components/ReviewList/ReviewListProps.js +2 -0
- package/dist/Components/ReviewSummary/ReviewSummary.d.ts +4 -0
- package/dist/Components/ReviewSummary/ReviewSummary.js +47 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.d.ts +31 -0
- package/dist/Components/ReviewSummary/ReviewSummaryProps.js +2 -0
- package/dist/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/Components/SegmentedControl/SegmentedControl.js +17 -5
- package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +6 -0
- package/dist/Components/SegmentedControl/segmentedInk.d.ts +2 -0
- package/dist/Components/SegmentedControl/segmentedInk.js +4 -1
- package/dist/Components/SegmentedControl/useSlidingPill.d.ts +2 -0
- package/dist/Components/SegmentedControl/useSlidingPill.js +6 -1
- package/dist/Components/SideBar/SecondaryBar.js +13 -8
- package/dist/Components/SideBar/SideBarProps.d.ts +3 -1
- package/dist/Components/SideBar/components/MenuItemBox.js +47 -10
- package/dist/Components/SideBar/components/MenuPopoverContent.js +4 -3
- package/dist/Components/SpecTable/SpecTable.d.ts +4 -0
- package/dist/Components/SpecTable/SpecTable.js +39 -0
- package/dist/Components/SpecTable/SpecTableProps.d.ts +25 -0
- package/dist/Components/SpecTable/SpecTableProps.js +2 -0
- package/dist/Components/Spinner/Spinner.d.ts +1 -1
- package/dist/Components/Spinner/Spinner.js +2 -2
- package/dist/Components/Spinner/SpinnerProps.d.ts +2 -0
- package/dist/Components/StageProgress/StepperStage.js +2 -1
- package/dist/Components/StatCard/StatCard.d.ts +1 -1
- package/dist/Components/StatCard/StatCard.js +2 -2
- package/dist/Components/StatCard/StatCardProps.d.ts +4 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.d.ts +3 -0
- package/dist/Components/StickyBuyBar/StickyBuyBar.js +85 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.d.ts +54 -0
- package/dist/Components/StickyBuyBar/StickyBuyBarProps.js +2 -0
- package/dist/Components/StockStatus/StockStatus.d.ts +4 -0
- package/dist/Components/StockStatus/StockStatus.js +31 -0
- package/dist/Components/StockStatus/StockStatusProps.d.ts +14 -0
- package/dist/Components/StockStatus/StockStatusProps.js +2 -0
- package/dist/Components/Table/Table.js +2 -1
- package/dist/Components/Table/TableProps.d.ts +5 -2
- package/dist/Components/Table/columnLabel.d.ts +6 -0
- package/dist/Components/Table/columnLabel.js +27 -0
- package/dist/Components/Table/components/TableBody.js +5 -1
- package/dist/Components/Table/components/TableHeader.js +3 -2
- package/dist/Components/Table/filters/ActiveFilters.js +2 -1
- package/dist/Components/Table/filters/TableFilters.js +2 -1
- package/dist/Components/Table/hooks/useTable.js +3 -2
- package/dist/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/Components/Table/settings/TableSettings.js +2 -1
- package/dist/Components/TrustBadges/TrustBadges.d.ts +4 -0
- package/dist/Components/TrustBadges/TrustBadges.js +24 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.d.ts +20 -0
- package/dist/Components/TrustBadges/TrustBadgesProps.js +2 -0
- package/dist/Components/VariantSelector/VariantSelector.d.ts +4 -0
- package/dist/Components/VariantSelector/VariantSelector.js +123 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.d.ts +27 -0
- package/dist/Components/VariantSelector/VariantSelectorProps.js +2 -0
- package/dist/Components/VariantSelector/variantSelection.d.ts +6 -0
- package/dist/Components/VariantSelector/variantSelection.js +25 -0
- package/dist/Components/WishlistToggle/WishlistToggle.d.ts +4 -0
- package/dist/Components/WishlistToggle/WishlistToggle.js +65 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.d.ts +19 -0
- package/dist/Components/WishlistToggle/WishlistToggleProps.js +2 -0
- package/dist/Theme/assertPalette.d.ts +1 -1
- package/dist/Theme/assertPalette.js +1 -1
- package/dist/Theme/tokens/brands/index.js +2 -0
- package/dist/Theme/tokens/brands/zinc/palette.dark.d.ts +1 -0
- package/dist/Theme/tokens/builders/buildDarkPalette.js +2 -0
- package/dist/Theme/tokens/builders/index.d.ts +1 -0
- package/dist/Theme/tokens/builders/index.js +1 -0
- package/dist/Theme/tokens/builders/rechartsTheme.d.ts +56 -0
- package/dist/Theme/tokens/builders/rechartsTheme.js +43 -0
- package/dist/Theme/tokens/builders/star.d.ts +3 -0
- package/dist/Theme/tokens/builders/star.js +8 -0
- package/dist/Theme/tokens/types.d.ts +3 -1
- package/dist/Theme/useChartTheme.d.ts +4 -0
- package/dist/Theme/useChartTheme.js +12 -0
- package/dist/Utils/price.d.ts +16 -0
- package/dist/Utils/price.js +34 -0
- package/dist/esm/Components/AddressCard/AddressCard.js +20 -0
- package/dist/esm/Components/AddressCard/AddressCardGroup.js +5 -0
- package/dist/esm/Components/AddressCard/AddressCardProps.js +1 -0
- package/dist/esm/Components/BagBar/BagBar.js +27 -0
- package/dist/esm/Components/BagBar/BagBarProps.js +1 -0
- package/dist/esm/Components/CartItem/CartItem.js +55 -0
- package/dist/esm/Components/CartItem/CartItemProps.js +1 -0
- package/dist/esm/Components/CartItem/cartItemOptions.js +9 -0
- package/dist/esm/Components/CheckoutKit/selectable.js +112 -0
- package/dist/esm/Components/Commerce/commerceTypes.js +1 -0
- package/dist/esm/Components/Commerce/commerceVariants.js +41 -0
- package/dist/esm/Components/Commerce/index.js +2 -0
- package/dist/esm/Components/Commerce/useContainerWidth.js +21 -0
- package/dist/esm/Components/CouponField/CouponField.js +67 -0
- package/dist/esm/Components/CouponField/CouponFieldProps.js +1 -0
- package/dist/esm/Components/DatePicker/PickerPortal.js +21 -0
- package/dist/esm/Components/DatePicker/RangeDatePicker.js +34 -32
- package/dist/esm/Components/DatePicker/SingleDatePicker.js +16 -13
- package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +6 -4
- package/dist/esm/Components/DetailSections/DetailSections.js +107 -0
- package/dist/esm/Components/DetailSections/DetailSectionsProps.js +1 -0
- package/dist/esm/Components/MediaGallery/MediaFrame.js +48 -0
- package/dist/esm/Components/MediaGallery/MediaGallery.js +201 -0
- package/dist/esm/Components/MediaGallery/MediaGalleryProps.js +17 -0
- package/dist/esm/Components/MediaGallery/MediaLightbox.js +78 -0
- package/dist/esm/Components/MediaGallery/MediaLightboxProps.js +12 -0
- package/dist/esm/Components/MediaGallery/MediaThumb.js +23 -0
- package/dist/esm/Components/MediaGallery/glass.js +42 -0
- package/dist/esm/Components/MediaGallery/mediaGalleryModel.js +71 -0
- package/dist/esm/Components/MediaGallery/motion.js +8 -0
- package/dist/esm/Components/MediaGallery/useMatchMedia.js +16 -0
- package/dist/esm/Components/OffersList/OffersList.js +81 -0
- package/dist/esm/Components/OffersList/OffersListProps.js +1 -0
- package/dist/esm/Components/OptionChip/OptionChip.js +95 -0
- package/dist/esm/Components/OptionChip/OptionChipProps.js +1 -0
- package/dist/esm/Components/OptionChip/optionInk.js +21 -0
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimeline.js +55 -0
- package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +1 -0
- package/dist/esm/Components/OrderSummary/OrderSummary.js +58 -0
- package/dist/esm/Components/OrderSummary/OrderSummaryProps.js +1 -0
- package/dist/esm/Components/PaymentOption/PaymentOption.js +19 -0
- package/dist/esm/Components/PaymentOption/PaymentOptionGroup.js +5 -0
- package/dist/esm/Components/PaymentOption/PaymentOptionProps.js +1 -0
- package/dist/esm/Components/PincodeChecker/PincodeChecker.js +170 -0
- package/dist/esm/Components/PincodeChecker/PincodeCheckerProps.js +1 -0
- package/dist/esm/Components/PriceBlock/PriceBlock.js +39 -0
- package/dist/esm/Components/PriceBlock/PriceBlockProps.js +1 -0
- package/dist/esm/Components/ProductBadges/ProductBadges.js +59 -0
- package/dist/esm/Components/ProductBadges/ProductBadgesProps.js +1 -0
- package/dist/esm/Components/ProductCard/ProductCard.js +105 -54
- package/dist/esm/Components/ProductCard/ProductCardAction.js +60 -0
- package/dist/esm/Components/ProductCard/ProductCardGrid.js +18 -0
- package/dist/esm/Components/ProductCard/ProductCardMedia.js +33 -0
- package/dist/esm/Components/ProductCard/ProductCardSkeleton.js +12 -0
- package/dist/esm/Components/ProductCard/ProductCardSwatches.js +35 -0
- package/dist/esm/Components/ProductCard/QuickAddSheet.js +71 -0
- package/dist/esm/Components/ProductCard/QuickAddSheetProps.js +1 -0
- package/dist/esm/Components/ProductCard/cardLabels.js +13 -0
- package/dist/esm/Components/ProductCard/cardMetrics.js +52 -0
- package/dist/esm/Components/ProductCard/productCardFixtures.js +58 -0
- package/dist/esm/Components/ProductCard/productCardModel.js +65 -0
- package/dist/esm/Components/ProductCard/useMinWidth.js +16 -0
- package/dist/esm/Components/ProductDetails/ProductDetails.js +210 -34
- package/dist/esm/Components/ProductDetails/productDetailsModel.js +35 -0
- package/dist/esm/Components/ProductDetails/useInViewport.js +14 -0
- package/dist/esm/Components/QuantityStepper/QuantityStepper.js +57 -0
- package/dist/esm/Components/QuantityStepper/QuantityStepperProps.js +1 -0
- package/dist/esm/Components/Rating/Rating.js +79 -0
- package/dist/esm/Components/Rating/RatingProps.js +1 -0
- package/dist/esm/Components/ReviewList/ReviewList.js +89 -0
- package/dist/esm/Components/ReviewList/ReviewListProps.js +1 -0
- package/dist/esm/Components/ReviewSummary/ReviewSummary.js +42 -0
- package/dist/esm/Components/ReviewSummary/ReviewSummaryProps.js +1 -0
- package/dist/esm/Components/SegmentedControl/SegmentedControl.js +19 -7
- package/dist/esm/Components/SegmentedControl/segmentedInk.js +2 -0
- package/dist/esm/Components/SegmentedControl/useSlidingPill.js +6 -1
- package/dist/esm/Components/SideBar/SecondaryBar.js +14 -9
- package/dist/esm/Components/SideBar/components/MenuItemBox.js +14 -10
- package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +4 -3
- package/dist/esm/Components/SpecTable/SpecTable.js +34 -0
- package/dist/esm/Components/SpecTable/SpecTableProps.js +1 -0
- package/dist/esm/Components/Spinner/Spinner.js +2 -2
- package/dist/esm/Components/StageProgress/StepperStage.js +2 -1
- package/dist/esm/Components/StatCard/StatCard.js +2 -2
- package/dist/esm/Components/StickyBuyBar/StickyBuyBar.js +80 -0
- package/dist/esm/Components/StickyBuyBar/StickyBuyBarProps.js +1 -0
- package/dist/esm/Components/StockStatus/StockStatus.js +29 -0
- package/dist/esm/Components/StockStatus/StockStatusProps.js +1 -0
- package/dist/esm/Components/Table/Table.js +2 -1
- package/dist/esm/Components/Table/columnLabel.js +21 -0
- package/dist/esm/Components/Table/components/TableBody.js +5 -1
- package/dist/esm/Components/Table/components/TableHeader.js +3 -2
- package/dist/esm/Components/Table/filters/ActiveFilters.js +2 -1
- package/dist/esm/Components/Table/filters/TableFilters.js +2 -1
- package/dist/esm/Components/Table/hooks/useTable.js +3 -2
- package/dist/esm/Components/Table/settings/ManageColumns.js +4 -3
- package/dist/esm/Components/Table/settings/TableSettings.js +2 -1
- package/dist/esm/Components/TrustBadges/TrustBadges.js +22 -0
- package/dist/esm/Components/TrustBadges/TrustBadgesProps.js +1 -0
- package/dist/esm/Components/VariantSelector/VariantSelector.js +118 -0
- package/dist/esm/Components/VariantSelector/VariantSelectorProps.js +1 -0
- package/dist/esm/Components/VariantSelector/variantSelection.js +19 -0
- package/dist/esm/Components/WishlistToggle/WishlistToggle.js +63 -0
- package/dist/esm/Components/WishlistToggle/WishlistToggleProps.js +1 -0
- package/dist/esm/Theme/assertPalette.js +1 -1
- package/dist/esm/Theme/tokens/brands/index.js +2 -0
- package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +2 -0
- package/dist/esm/Theme/tokens/builders/index.js +1 -0
- package/dist/esm/Theme/tokens/builders/rechartsTheme.js +37 -0
- package/dist/esm/Theme/tokens/builders/star.js +4 -0
- package/dist/esm/Theme/useChartTheme.js +8 -0
- package/dist/esm/Utils/price.js +27 -0
- package/dist/esm/index.js +36 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +86 -4
- package/package.json +1 -1
- package/dist/Components/ProductCard/ProductLabel.d.ts +0 -7
- package/dist/Components/ProductCard/ProductLabel.js +0 -20
- package/dist/Components/ProductCard/ProductPrice.d.ts +0 -10
- package/dist/Components/ProductCard/ProductPrice.js +0 -126
- package/dist/Components/ProductCard/ProductReview.d.ts +0 -8
- package/dist/Components/ProductCard/ProductReview.js +0 -30
- package/dist/Components/ProductCard/ProductTags.d.ts +0 -8
- package/dist/Components/ProductCard/ProductTags.js +0 -53
- package/dist/Components/ProductDetails/ProductDtlPrice.d.ts +0 -7
- package/dist/Components/ProductDetails/ProductDtlPrice.js +0 -24
- package/dist/Components/ProductDetails/ProductImageSlider.d.ts +0 -13
- package/dist/Components/ProductDetails/ProductImageSlider.js +0 -240
- package/dist/esm/Components/ProductCard/ProductLabel.js +0 -18
- package/dist/esm/Components/ProductCard/ProductPrice.js +0 -121
- package/dist/esm/Components/ProductCard/ProductReview.js +0 -28
- package/dist/esm/Components/ProductCard/ProductTags.js +0 -48
- package/dist/esm/Components/ProductDetails/ProductDtlPrice.js +0 -22
- package/dist/esm/Components/ProductDetails/ProductImageSlider.js +0 -204
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { Box, Flex, Text, VisuallyHidden } from "@chakra-ui/react";
|
|
4
|
+
import { BadgeCheck, ThumbsUp } from "lucide-react";
|
|
5
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
|
+
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
7
|
+
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
8
|
+
import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
|
|
9
|
+
import { DEFAULT_LOCALE } from "../../Utils/price.js";
|
|
10
|
+
import Button from "../Button/Button.js";
|
|
11
|
+
import Rating from "../Rating/Rating.js";
|
|
12
|
+
import Skeletons from "../Skeletons/Skeletons.js";
|
|
13
|
+
const DEFAULT_LABELS = {
|
|
14
|
+
verified: "Verified purchase",
|
|
15
|
+
helpful: (count) => `Helpful (${count})`,
|
|
16
|
+
readMore: "Read more",
|
|
17
|
+
readLess: "Read less",
|
|
18
|
+
loadMore: "Load more reviews",
|
|
19
|
+
loadingMore: "Loading more reviews…",
|
|
20
|
+
emptyTitle: "No reviews yet",
|
|
21
|
+
emptyBody: "Reviews from verified buyers will show up here.",
|
|
22
|
+
purchasedSize: (size) => `Size ${size}`,
|
|
23
|
+
loadingReviews: "Loading reviews",
|
|
24
|
+
moreLoaded: (count) => `${count} more ${count === 1 ? "review" : "reviews"} loaded`,
|
|
25
|
+
photoAlt: (author) => `Photo from ${author}'s review`,
|
|
26
|
+
};
|
|
27
|
+
const DATE_ONLY = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
28
|
+
const tabular = { fontVariantNumeric: "tabular-nums" };
|
|
29
|
+
const SKELETON_ROWS = [0, 1, 2];
|
|
30
|
+
const makeFormatter = (locale) => {
|
|
31
|
+
const options = { day: "numeric", month: "short", year: "numeric" };
|
|
32
|
+
try {
|
|
33
|
+
return new Intl.DateTimeFormat(locale, options);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return new Intl.DateTimeFormat(DEFAULT_LOCALE, options);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const formatDate = (raw, fmt) => {
|
|
40
|
+
const dateOnly = DATE_ONLY.exec(raw);
|
|
41
|
+
const parsed = dateOnly ? new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3])) : new Date(raw);
|
|
42
|
+
if (Number.isNaN(parsed.getTime()))
|
|
43
|
+
return { text: raw, valid: false };
|
|
44
|
+
return { text: fmt.format(parsed), valid: true };
|
|
45
|
+
};
|
|
46
|
+
const Dot = () => (_jsx(Text, { as: "span", "aria-hidden": true, children: "\u00B7" }));
|
|
47
|
+
const ReviewRow = ({ review, index, clampChars, fmt, labels, pressed, expanded, onToggleHelpful, onToggleExpanded }) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const { colors } = useCustomTheme();
|
|
50
|
+
const bodyId = useId();
|
|
51
|
+
const isLong = review.body.length > clampChars;
|
|
52
|
+
const date = formatDate(review.date, fmt);
|
|
53
|
+
const count = ((_a = review.helpful) !== null && _a !== void 0 ? _a : 0) + (pressed ? 1 : 0);
|
|
54
|
+
const showHelpful = review.helpful !== undefined || pressed;
|
|
55
|
+
return (_jsxs(Box, { as: "li", listStyleType: "none", "data-testid": `review-${review.id}`, children: [index > 0 && _jsx(Box, { "aria-hidden": true, h: "1px", bg: colors.background[100] }), _jsxs(Flex, { direction: "column", gap: 2.5, py: 6, children: [_jsxs(Flex, { align: "center", gap: 2, wrap: "wrap", children: [_jsx(Rating, { value: review.rating, size: "sm", showValue: false }), review.title && (_jsx(Text, { as: "h3", fontSize: "md", fontWeight: 600, lineHeight: 1.4, color: colors.header[900], children: review.title }))] }), _jsxs(Box, { children: [_jsx(Text, { id: bodyId, fontSize: "sm", lineHeight: 1.6, color: colors.text[700], noOfLines: isLong && !expanded ? 4 : undefined, children: review.body }), isLong && (_jsx(Box, { as: "button", type: "button", mt: 1, fontSize: "sm", fontWeight: 600, color: colors.accentText, "aria-expanded": expanded, "aria-controls": bodyId, onClick: () => onToggleExpanded(review.id), borderRadius: "sm", transition: transitionFor(["opacity"]), _hover: { opacity: 0.8 }, sx: { ...focusVisibleStyles(colors), ...reducedMotionSx() }, children: expanded ? labels.readLess : labels.readMore }))] }), review.media && review.media.length > 0 && (_jsx(Flex, { gap: 2, wrap: "wrap", children: review.media.map((m) => {
|
|
56
|
+
var _a;
|
|
57
|
+
return (_jsx(Box, { boxSize: "72px", borderRadius: "12px", overflow: "hidden", bg: colors.background[100], flexShrink: 0, children: _jsx("img", { src: m.src, alt: (_a = m.alt) !== null && _a !== void 0 ? _a : labels.photoAlt(review.author), loading: "lazy", style: { width: "100%", height: "100%", objectFit: "cover" } }) }, m.id));
|
|
58
|
+
}) })), _jsxs(Flex, { align: "center", gap: 2, wrap: "wrap", fontSize: "xs", color: colors.textMuted, sx: tabular, children: [_jsx(Text, { as: "span", fontWeight: 600, color: colors.header[900], children: review.author }), review.city && (_jsxs(_Fragment, { children: [_jsx(Dot, {}), _jsx(Text, { as: "span", children: review.city })] })), _jsx(Dot, {}), date.valid ? (_jsx("time", { dateTime: review.date, children: date.text })) : (_jsx(Text, { as: "span", children: date.text })), review.purchasedSize && (_jsxs(_Fragment, { children: [_jsx(Dot, {}), _jsx(Text, { as: "span", children: labels.purchasedSize(review.purchasedSize) })] })), review.verified && (_jsxs(_Fragment, { children: [_jsx(Dot, {}), _jsxs(Flex, { as: "span", align: "center", gap: 1, fontWeight: 600, color: colors.semanticText.success, children: [_jsx(BadgeCheck, { size: 14, "aria-hidden": true, focusable: "false" }), labels.verified] })] }))] }), showHelpful && (_jsx(Box, { children: _jsx(Button, { variant: "ghost", size: "sm", "aria-pressed": pressed, onClick: () => onToggleHelpful(review), leftIcon: _jsx(ThumbsUp, { size: 14, "aria-hidden": true, fill: pressed ? "currentColor" : "none" }), sx: { color: pressed ? colors.header[900] : colors.textMuted, fontVariantNumeric: "tabular-nums" }, children: labels.helpful(count) }) }))] })] }));
|
|
59
|
+
};
|
|
60
|
+
const SkeletonRow = () => (_jsx(Box, { as: "li", listStyleType: "none", "aria-hidden": true, py: 6, children: _jsxs(Flex, { direction: "column", gap: 3, children: [_jsx(Skeletons, { type: "skeleton", width: "80px", height: "14px", borderRadius: "sm" }), _jsxs(Flex, { direction: "column", gap: 2, children: [_jsx(Skeletons, { type: "skeleton", width: "100%", height: "12px", borderRadius: "sm" }), _jsx(Skeletons, { type: "skeleton", width: "94%", height: "12px", borderRadius: "sm" }), _jsx(Skeletons, { type: "skeleton", width: "60%", height: "12px", borderRadius: "sm" })] }), _jsx(Skeletons, { type: "skeleton", width: "180px", height: "12px", borderRadius: "sm" })] }) }));
|
|
61
|
+
/** Customer reviews: stars, clamped body, verified marker, helpful vote and load-more paging, with a slot for sorting. */
|
|
62
|
+
const ReviewList = ({ reviews, onHelpful, clampChars = 220, sortSlot, hasMore = false, onLoadMore, isLoading = false, isLoadingMore = false, emptyState, locale = DEFAULT_LOCALE, labels, "data-testid": testId, }) => {
|
|
63
|
+
const { colors } = useCustomTheme();
|
|
64
|
+
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
65
|
+
const fmt = useMemo(() => makeFormatter(locale), [locale]);
|
|
66
|
+
const [pressed, setPressed] = useState({});
|
|
67
|
+
const [expanded, setExpanded] = useState({});
|
|
68
|
+
const [announcement, setAnnouncement] = useState("");
|
|
69
|
+
const previousCount = useRef(reviews.length);
|
|
70
|
+
const moreLoaded = copy.moreLoaded;
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const added = reviews.length - previousCount.current;
|
|
73
|
+
const hadReviews = previousCount.current > 0;
|
|
74
|
+
previousCount.current = reviews.length;
|
|
75
|
+
setAnnouncement(!isLoading && hadReviews && added > 0 ? moreLoaded(added) : "");
|
|
76
|
+
}, [reviews.length, isLoading, moreLoaded]);
|
|
77
|
+
const toggleHelpful = (review) => {
|
|
78
|
+
const next = !pressed[review.id];
|
|
79
|
+
setPressed((prev) => ({ ...prev, [review.id]: next }));
|
|
80
|
+
if (next)
|
|
81
|
+
onHelpful === null || onHelpful === void 0 ? void 0 : onHelpful(review.id);
|
|
82
|
+
};
|
|
83
|
+
const toggleExpanded = (id) => setExpanded((prev) => ({ ...prev, [id]: !prev[id] }));
|
|
84
|
+
const isEmpty = !isLoading && reviews.length === 0;
|
|
85
|
+
return (_jsxs(Box, { as: "section", "data-testid": testId, children: [sortSlot && (_jsx(Flex, { justify: "flex-end", mb: 4, children: sortSlot })), isEmpty ? ((emptyState !== null && emptyState !== void 0 ? emptyState : (_jsxs(Flex, { direction: "column", align: "center", gap: 1, py: 12, textAlign: "center", children: [_jsx(Text, { fontSize: "md", fontWeight: 600, color: colors.header[900], children: copy.emptyTitle }), _jsx(Text, { fontSize: "sm", color: colors.textMuted, children: copy.emptyBody })] })))) : (_jsx(Box, { as: "ul", m: 0, p: 0, "aria-busy": isLoading || undefined, children: isLoading
|
|
86
|
+
? SKELETON_ROWS.map((n) => _jsx(SkeletonRow, {}, n))
|
|
87
|
+
: reviews.map((review, index) => (_jsx(ReviewRow, { review: review, index: index, clampChars: clampChars, fmt: fmt, labels: copy, pressed: !!pressed[review.id], expanded: !!expanded[review.id], onToggleHelpful: toggleHelpful, onToggleExpanded: toggleExpanded }, review.id))) })), hasMore && !isLoading && !isEmpty && (_jsx(Flex, { justify: "center", mt: 4, children: _jsx(Button, { variant: "outline", size: "md", onClick: onLoadMore, isDisabled: isLoadingMore, "aria-busy": isLoadingMore || undefined, children: isLoadingMore ? copy.loadingMore : copy.loadMore }) })), _jsx(VisuallyHidden, { role: "status", "aria-live": "polite", children: isLoading ? copy.loadingReviews : announcement })] }));
|
|
88
|
+
};
|
|
89
|
+
export default ReviewList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Flex, Text } from "@chakra-ui/react";
|
|
3
|
+
import { Star } from "lucide-react";
|
|
4
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
5
|
+
import { DEFAULT_LOCALE } from "../../Utils/price.js";
|
|
6
|
+
import Rating from "../Rating/Rating.js";
|
|
7
|
+
import Button from "../Button/Button.js";
|
|
8
|
+
const STARS = [5, 4, 3, 2, 1];
|
|
9
|
+
const DEFAULT_MIN_RATINGS_FOR_BARS = 10;
|
|
10
|
+
const tabular = { fontVariantNumeric: "tabular-nums" };
|
|
11
|
+
const defaultLabels = (locale) => ({
|
|
12
|
+
heading: "Ratings & reviews",
|
|
13
|
+
writeReview: "Write a review",
|
|
14
|
+
ratings: (count) => `${new Intl.NumberFormat(locale).format(count)} ${count === 1 ? "rating" : "ratings"}`,
|
|
15
|
+
emptyTitle: "No reviews yet",
|
|
16
|
+
emptyBody: "Bought this? Be the first to say how it fits.",
|
|
17
|
+
bar: (stars, percent) => `${stars} ${stars === 1 ? "star" : "stars"}, ${percent}%`,
|
|
18
|
+
});
|
|
19
|
+
const percentages = (breakdown) => {
|
|
20
|
+
const total = STARS.reduce((sum, stars) => sum + breakdown[stars], 0);
|
|
21
|
+
return (stars) => (total > 0 ? Math.round((breakdown[stars] / total) * 100) : 0);
|
|
22
|
+
};
|
|
23
|
+
/** Average rating, count and a five-row distribution; scales down to a thin summary or an invitation when there is little or no evidence. */
|
|
24
|
+
const ReviewSummary = ({ rating, count, breakdown, minRatingsForBars = DEFAULT_MIN_RATINGS_FOR_BARS, onWriteReview, id, locale = DEFAULT_LOCALE, labels, "data-testid": testId, }) => {
|
|
25
|
+
const { colors } = useCustomTheme();
|
|
26
|
+
const copy = { ...defaultLabels(locale), ...labels };
|
|
27
|
+
const empty = count <= 0 || rating <= 0;
|
|
28
|
+
const showBars = !empty && !!breakdown && count >= minRatingsForBars;
|
|
29
|
+
const average = Math.min(5, Math.max(0, rating));
|
|
30
|
+
const averageText = new Intl.NumberFormat(locale, { minimumFractionDigits: 1, maximumFractionDigits: 1 }).format(average);
|
|
31
|
+
const nf = new Intl.NumberFormat(locale);
|
|
32
|
+
const writeButton = onWriteReview ? (_jsx(Button, { variant: "outline", onClick: onWriteReview, children: copy.writeReview })) : null;
|
|
33
|
+
const distribution = (counts) => {
|
|
34
|
+
const percentOf = percentages(counts);
|
|
35
|
+
return (_jsx(Flex, { direction: "column", gap: 2, flex: "1", minW: 0, maxW: "26rem", w: "100%", children: STARS.map((stars) => {
|
|
36
|
+
const percent = percentOf(stars);
|
|
37
|
+
return (_jsxs(Box, { display: "grid", gridTemplateColumns: "2.25rem minmax(0, 1fr) 3.5rem", alignItems: "center", columnGap: 3, children: [_jsxs(Flex, { "aria-hidden": true, align: "center", gap: 1, fontSize: "sm", color: colors.text[800], sx: tabular, children: [_jsx("span", { children: stars }), _jsx(Star, { size: 12, fill: "currentColor", strokeWidth: 1.5 })] }), _jsx(Box, { role: "meter", "aria-label": copy.bar(stars, percent), "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": percent, h: "0.5rem", borderRadius: "full", bg: colors.background[200], overflow: "hidden", children: _jsx(Box, { h: "100%", w: `${percent}%`, borderRadius: "full", bg: colors.star }) }), _jsx(Text, { "aria-hidden": true, fontSize: "sm", textAlign: "right", color: colors.textMuted, sx: tabular, children: nf.format(counts[stars]) })] }, stars));
|
|
38
|
+
}) }));
|
|
39
|
+
};
|
|
40
|
+
return (_jsxs(Box, { as: "section", "aria-labelledby": id, "data-testid": testId, children: [_jsx(Text, { as: "h2", id: id, fontSize: "lg", fontWeight: 700, lineHeight: 1.3, color: colors.header[900], children: copy.heading }), empty ? (_jsxs(Flex, { direction: "column", align: "flex-start", gap: 1, mt: 4, children: [_jsx(Text, { fontSize: "md", fontWeight: 600, color: colors.header[900], children: copy.emptyTitle }), _jsx(Text, { fontSize: "sm", color: colors.textMuted, children: copy.emptyBody }), writeButton ? _jsx(Box, { mt: 3, children: writeButton }) : null] })) : (_jsxs(_Fragment, { children: [_jsxs(Flex, { direction: { base: "column", sm: "row" }, align: { base: "flex-start", sm: "center" }, gap: { base: 5, sm: 10 }, mt: 4, children: [_jsxs(Flex, { direction: "column", align: "flex-start", gap: 1.5, flexShrink: 0, children: [_jsx(Text, { fontSize: "3rem", lineHeight: 1, fontWeight: 700, letterSpacing: "-0.02em", color: colors.header[900], sx: tabular, children: averageText }), _jsx(Rating, { value: average, size: "md", showValue: false }), _jsx(Text, { fontSize: "sm", color: colors.textMuted, sx: tabular, children: copy.ratings(count) })] }), showBars && breakdown ? distribution(breakdown) : null] }), writeButton ? _jsx(Box, { mt: 5, children: writeButton }) : null] }))] }));
|
|
41
|
+
};
|
|
42
|
+
export default ReviewSummary;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { Box, Flex } from "@chakra-ui/react";
|
|
3
|
+
import { Box, Flex, useBreakpointValue } from "@chakra-ui/react";
|
|
4
4
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
5
5
|
import { resolveFilledSurface } from "../../Theme/tokens/builders/filledSurface.js";
|
|
6
6
|
import { BUTTON_SIZES } from "../../Theme/tokens/primitives/controlSizes.js";
|
|
@@ -11,7 +11,7 @@ import { AA_NORMAL_TEXT } from "../../Theme/tokens/builders/accentText.js";
|
|
|
11
11
|
import { liftToContrast } from "../../Theme/tokens/builders/outlineRung.js";
|
|
12
12
|
import Tag from "../Tag/Tag.js";
|
|
13
13
|
import { useSlidingPill } from "./useSlidingPill.js";
|
|
14
|
-
import { segmentedFocusShadow, segmentedPlateEdge, segmentedRestInk, segmentedTrackSurface, } from "./segmentedInk.js";
|
|
14
|
+
import { segmentedFocusShadow, segmentedPlateEdge, segmentedRestInk, segmentedSelectedSurface, segmentedTrackSurface, } from "./segmentedInk.js";
|
|
15
15
|
const TRACK_PADDING = "0.125rem";
|
|
16
16
|
const UNDERLINE_WIDTH = "0.0625rem";
|
|
17
17
|
const SLIDE = transitionFor(["transform", "width"], "base");
|
|
@@ -19,16 +19,20 @@ const MAX_COUNT = 99;
|
|
|
19
19
|
const COUNT_TAG_SIZE = { sm: "xs", md: "sm", lg: "md" };
|
|
20
20
|
const formatCount = (count) => (count > MAX_COUNT ? `${MAX_COUNT}+` : `${count}`);
|
|
21
21
|
/** Renders role="radiogroup" of role="radio" buttons with roving tabindex, not a native form radio group; shares variant with Toggle/TableToggle (see MODULE.md). */
|
|
22
|
-
export default function SegmentedControl({ options, value, onChange, size = "sm", isFullWidth = false, variant = "default", surface, "aria-label": ariaLabel, }) {
|
|
22
|
+
export default function SegmentedControl({ options, value, onChange, size = "sm", isFullWidth = false, variant = "default", orientation = "horizontal", surface, "aria-label": ariaLabel, }) {
|
|
23
|
+
var _a;
|
|
23
24
|
const { colors, radii } = useCustomTheme();
|
|
24
25
|
const control = BUTTON_SIZES[size];
|
|
25
26
|
const isBrandSlide = variant === "brandSlide";
|
|
26
27
|
const isUnderlineSlide = variant === "underlineSlide";
|
|
27
28
|
const hasIndicator = isBrandSlide || isUnderlineSlide;
|
|
29
|
+
const isVertical = orientation === "vertical";
|
|
30
|
+
// Below "md" a shortLabel (when the option has one) replaces the full label; the full label stays the accessible name.
|
|
31
|
+
const isCompact = (_a = useBreakpointValue({ base: true, md: false }, { ssr: false })) !== null && _a !== void 0 ? _a : false;
|
|
28
32
|
const brandFill = resolveFilledSurface(colors.primary, colors);
|
|
29
33
|
const trackSurface = segmentedTrackSurface(variant, colors, surface);
|
|
30
34
|
const restInk = segmentedRestInk(colors, trackSurface);
|
|
31
|
-
const selectedInk = liftToContrast(colors.accentText, trackSurface, AA_NORMAL_TEXT);
|
|
35
|
+
const selectedInk = liftToContrast(colors.accentText, segmentedSelectedSurface(variant, colors, trackSurface), AA_NORMAL_TEXT);
|
|
32
36
|
const hoverInk = liftToContrast(colors.text[900], trackSurface, AA_NORMAL_TEXT);
|
|
33
37
|
const segmentH = `calc(${control.height} - ${isUnderlineSlide ? UNDERLINE_WIDTH : `2 * ${TRACK_PADDING}`})`;
|
|
34
38
|
// Concentric: an inset child keeping the parent's radius bulges at the corners.
|
|
@@ -54,6 +58,8 @@ export default function SegmentedControl({ options, value, onChange, size = "sm"
|
|
|
54
58
|
options,
|
|
55
59
|
isFullWidth,
|
|
56
60
|
size,
|
|
61
|
+
orientation,
|
|
62
|
+
isCompact,
|
|
57
63
|
]);
|
|
58
64
|
const selectAt = (index) => {
|
|
59
65
|
var _a;
|
|
@@ -84,11 +90,17 @@ export default function SegmentedControl({ options, value, onChange, size = "sm"
|
|
|
84
90
|
selectAt(enabled[enabled.length - 1]);
|
|
85
91
|
}
|
|
86
92
|
};
|
|
87
|
-
return (_jsxs(Flex, { ref: trackRef, role: "radiogroup", "aria-label": ariaLabel, onKeyDown: handleKeyDown, onFocus: (event) => setShowFocus(event.target.matches(":focus-visible")), onBlur: () => setShowFocus(false), boxShadow: showFocus && !isUnderlineSlide ? focusShadow : plateEdge, position: "relative", display: "inline-flex", align: "center", gap: isUnderlineSlide ? "0" : TRACK_PADDING, p: isUnderlineSlide ? "0" : TRACK_PADDING, h: control.height, boxSizing: "border-box", borderRadius: isUnderlineSlide ? "none" : "lg", borderBottom: isUnderlineSlide ? `${UNDERLINE_WIDTH} solid ${colors.boxborder[200]}` : undefined, bg: isUnderlineSlide ? "transparent" : trackSurface, w: isFullWidth ? "100%" : "fit-content", minW: "max-content", children: [isBrandSlide && pill && (_jsx(Box, { "aria-hidden": "true", position: "absolute", top: TRACK_PADDING, left: 0, h: segmentH, w: `${pill.width}px`, borderRadius: innerRadius, bg: brandFill.fill, boxShadow: `0 0.125rem 0.5rem ${colors.boxShadow.primary}`, transform: `translateX(${pill.left}px)`, transition: SLIDE, sx: reducedMotionSx() })), isUnderlineSlide && pill && (_jsx(Box, { "aria-hidden": "true", position: "absolute", bottom: "-0.0625rem", left: 0, h: "0.125rem", w: `${pill.width}px`, borderRadius: "full", bg: colors.primary[500], transform: `translateX(${pill.left}px)`, transition: SLIDE, sx: reducedMotionSx() })), options.map((option, index) => {
|
|
93
|
+
return (_jsxs(Flex, { ref: trackRef, role: "radiogroup", "aria-label": ariaLabel, "aria-orientation": isVertical ? "vertical" : undefined, onKeyDown: handleKeyDown, onFocus: (event) => setShowFocus(event.target.matches(":focus-visible")), onBlur: () => setShowFocus(false), boxShadow: showFocus && !isUnderlineSlide ? focusShadow : plateEdge, position: "relative", display: "inline-flex", flexDirection: isVertical ? "column" : "row", align: isVertical ? "stretch" : "center", gap: isUnderlineSlide ? "0" : TRACK_PADDING, p: isUnderlineSlide ? "0" : TRACK_PADDING, h: isVertical ? "fit-content" : control.height, boxSizing: "border-box", borderRadius: isUnderlineSlide ? "none" : "lg", borderBottom: isUnderlineSlide && !isVertical ? `${UNDERLINE_WIDTH} solid ${colors.boxborder[200]}` : undefined, borderLeft: isUnderlineSlide && isVertical ? `${UNDERLINE_WIDTH} solid ${colors.boxborder[200]}` : undefined, bg: isUnderlineSlide ? "transparent" : trackSurface, w: isFullWidth ? "100%" : "fit-content", minW: "max-content", children: [isBrandSlide && pill && (_jsx(Box, { "aria-hidden": "true", position: "absolute", top: isVertical ? 0 : TRACK_PADDING, left: isVertical ? TRACK_PADDING : 0, right: isVertical ? TRACK_PADDING : undefined, h: segmentH, w: isVertical ? undefined : `${pill.width}px`, borderRadius: innerRadius, bg: brandFill.fill, boxShadow: `0 0.125rem 0.5rem ${colors.boxShadow.primary}`, transform: isVertical ? `translateY(${pill.top}px)` : `translateX(${pill.left}px)`, transition: SLIDE, sx: reducedMotionSx() })), isUnderlineSlide && pill && (_jsx(Box, { "aria-hidden": "true", position: "absolute", bottom: isVertical ? undefined : "-0.0625rem", left: isVertical ? "-0.0625rem" : 0, top: isVertical ? 0 : undefined, h: isVertical ? segmentH : "0.125rem", w: isVertical ? "0.125rem" : `${pill.width}px`, borderRadius: "full", bg: colors.primary[500], transform: isVertical ? `translateY(${pill.top}px)` : `translateX(${pill.left}px)`, transition: SLIDE, sx: reducedMotionSx() })), options.map((option, index) => {
|
|
88
94
|
const isSelected = option.value === value;
|
|
95
|
+
const showShortLabel = isCompact && !!option.shortLabel;
|
|
96
|
+
const displayLabel = showShortLabel ? option.shortLabel : option.label;
|
|
97
|
+
// Swapping to shortLabel must not shrink the accessible name — restate the full label (+ count) explicitly.
|
|
98
|
+
const compactAriaLabel = showShortLabel
|
|
99
|
+
? `${option.label}${option.count != null ? ` ${formatCount(option.count)}` : ""}`
|
|
100
|
+
: undefined;
|
|
89
101
|
return (_jsxs(Box, { as: "button", type: "button", ref: (node) => {
|
|
90
102
|
refs.current[index] = node;
|
|
91
|
-
}, role: "radio", "aria-checked": isSelected, disabled: option.isDisabled, tabIndex: index === tabIndex ? 0 : -1, onClick: () => onChange(option.value), position: "relative", zIndex: 1, display: "inline-flex", alignItems: "center", justifyContent: "center", gap: "0.375rem", flex: isFullWidth ? "1" : undefined, h: segmentH, px: control.paddingX, borderRadius: innerRadius, borderWidth: "1px", borderStyle: "solid", borderColor: hasIndicator
|
|
103
|
+
}, role: "radio", "aria-checked": isSelected, "aria-label": compactAriaLabel, disabled: option.isDisabled, tabIndex: index === tabIndex ? 0 : -1, onClick: () => onChange(option.value), position: "relative", zIndex: 1, display: "inline-flex", alignItems: "center", justifyContent: isVertical ? "flex-start" : "center", gap: "0.375rem", flex: isFullWidth ? "1" : undefined, h: segmentH, px: control.paddingX, borderRadius: innerRadius, borderWidth: "1px", borderStyle: "solid", borderColor: hasIndicator
|
|
92
104
|
? "transparent"
|
|
93
105
|
: isSelected
|
|
94
106
|
? colors.primary.opacity[32]
|
|
@@ -102,6 +114,6 @@ export default function SegmentedControl({ options, value, onChange, size = "sm"
|
|
|
102
114
|
_focusVisible: segmentFocus,
|
|
103
115
|
[FOCUS_VISIBLE_OVER_STATE]: segmentFocus,
|
|
104
116
|
...reducedMotionSx(),
|
|
105
|
-
}, children: [option.icon,
|
|
117
|
+
}, children: [option.icon, displayLabel, option.count != null && (_jsx(Tag, { label: formatCount(option.count), size: COUNT_TAG_SIZE[size], variant: "subtle", colorScheme: "gray" }))] }, option.value));
|
|
106
118
|
})] }));
|
|
107
119
|
}
|
|
@@ -11,6 +11,8 @@ export const segmentedTrackSurface = (variant, colors, surface) => {
|
|
|
11
11
|
return colors.surfaceRaised;
|
|
12
12
|
return colors.background[600];
|
|
13
13
|
};
|
|
14
|
+
/** The surface the selected label sits on: the default variant lifts it onto its own plate. */
|
|
15
|
+
export const segmentedSelectedSurface = (variant, colors, trackSurface) => (variant === "default" ? colors.backgroundColor.light : trackSurface);
|
|
14
16
|
/** Unselected label ink, lifted to AA against the track it is drawn on. */
|
|
15
17
|
export const segmentedRestInk = (colors, trackSurface) => liftToContrast(colors.text[600], trackSurface, AA_NORMAL_TEXT);
|
|
16
18
|
/** A radiogroup is one tab stop, so the group wears the ring: a brand hairline plus the field bloom. */
|
|
@@ -15,7 +15,12 @@ export function useSlidingPill(enabled, selectedIndex, extraDeps) {
|
|
|
15
15
|
}
|
|
16
16
|
const trackRect = track.getBoundingClientRect();
|
|
17
17
|
const nodeRect = node.getBoundingClientRect();
|
|
18
|
-
setPill({
|
|
18
|
+
setPill({
|
|
19
|
+
left: nodeRect.left - trackRect.left,
|
|
20
|
+
top: nodeRect.top - trackRect.top,
|
|
21
|
+
width: nodeRect.width,
|
|
22
|
+
height: nodeRect.height,
|
|
23
|
+
});
|
|
19
24
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
25
|
}, [enabled, selectedIndex, ...extraDeps]);
|
|
21
26
|
return { trackRef, itemRefs, pill };
|
|
@@ -5,7 +5,7 @@ import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
|
5
5
|
import { getSidebarActiveAccent } from "./sidebarAccentColors.js";
|
|
6
6
|
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
7
7
|
import { menuDisabled } from "./menuDisabled.js";
|
|
8
|
-
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
8
|
+
import { ChevronLeft, ChevronRight, LockKeyhole } from "lucide-react";
|
|
9
9
|
import OverflowTooltipText from "./components/OverflowTooltipText.js";
|
|
10
10
|
import ToolTip from "../ToolTip/ToolTip.js";
|
|
11
11
|
import { cssForScrollBar, HEADER_HEIGHT } from "../../Constants/Sidebar.js";
|
|
@@ -28,35 +28,40 @@ const parseBadge = (badge) => {
|
|
|
28
28
|
variant: (_c = badge === null || badge === void 0 ? void 0 : badge.variant) !== null && _c !== void 0 ? _c : "subtle",
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
+
// Matches MenuItemBox/MenuPopoverContent's isBlocked — locked also blocks, not just disabled.
|
|
32
|
+
const isItemBlocked = (item) => menuDisabled(item) || !!item.locked;
|
|
31
33
|
const CollapsedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
|
|
32
34
|
var _a;
|
|
33
35
|
const theme = useCustomTheme();
|
|
34
36
|
const activeAccent = getSidebarActiveAccent(theme.colors);
|
|
35
37
|
const { badgeVal, colorScheme, radius, variant } = parseBadge(item.badge);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
const blocked = isItemBlocked(item);
|
|
39
|
+
return (_jsxs(Popover, { trigger: "hover", placement: "right-start", closeOnBlur: false, isLazy: true, children: [_jsx(PopoverTrigger, { children: _jsx(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: {
|
|
40
|
+
bg: blocked
|
|
38
41
|
? "transparent"
|
|
39
42
|
: isActive
|
|
40
43
|
? "whiteAlpha.400"
|
|
41
44
|
: "whiteAlpha.200",
|
|
42
45
|
}, onClick: (e) => {
|
|
43
46
|
e.preventDefault();
|
|
44
|
-
if (!
|
|
47
|
+
if (!blocked)
|
|
45
48
|
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item);
|
|
46
|
-
}, bg: isActive ? "whiteAlpha.300" : "transparent", transition: "background 0.12s", children: _jsxs(Box, { position: "relative", display: "flex", alignItems: "center", children: [_jsx(Icon, { as: item.icon, fontSize: SIDEBAR_ROW.iconSize, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), badgeVal != null && (_jsx(Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.sidebar.semanticText.error }))] }) }) }), _jsx(Portal, { children: _jsx(PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", cursor:
|
|
49
|
+
}, bg: isActive ? "whiteAlpha.300" : "transparent", transition: "background 0.12s", children: _jsxs(Box, { position: "relative", display: "flex", alignItems: "center", children: [_jsx(Icon, { as: item.icon, fontSize: SIDEBAR_ROW.iconSize, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), badgeVal != null && (_jsx(Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.sidebar.semanticText.error }))] }) }) }), _jsx(Portal, { children: _jsx(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: _jsx(PopoverBody, { p: 3, children: _jsxs(Flex, { align: "center", gap: 2, justify: "space-between", children: [_jsxs(Flex, { align: "center", gap: 2, flex: "1", minW: 0, children: [_jsx(Icon, { as: item.icon, fontSize: "md", flexShrink: 0 }), _jsx(OverflowTooltipText, { placement: "right", maxWidth: "100%", fontSize: itemFontSize, fontWeight: "medium", as: "p", children: item.title })] }), item.locked ? (item.lockedReason ? (_jsx(ToolTip, { label: item.lockedReason, placement: "top", children: _jsx(Icon, { as: LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon }) })) : (_jsx(Icon, { as: LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon }))) : (badgeVal != null && (_jsx(Badge, { ...softBadge(theme.colors, colorScheme, sidebarRowPeak(theme.colors.sidebar.elevated)), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal })))] }) }) }) })] }));
|
|
47
50
|
};
|
|
48
51
|
const ExpandedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
|
|
49
52
|
var _a;
|
|
50
53
|
const theme = useCustomTheme();
|
|
51
54
|
const activeAccent = getSidebarActiveAccent(theme.colors);
|
|
52
55
|
const { badgeVal, colorScheme, radius, variant } = parseBadge(item.badge);
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
const blocked = isItemBlocked(item);
|
|
57
|
+
const row = (_jsxs(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: {
|
|
58
|
+
bg: blocked ? "transparent" : isActive ? "whiteAlpha.400" : "whiteAlpha.200",
|
|
55
59
|
}, onClick: (e) => {
|
|
56
60
|
e.preventDefault();
|
|
57
|
-
if (!
|
|
61
|
+
if (!blocked)
|
|
58
62
|
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item);
|
|
59
|
-
}, borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", transition: "background 0.12s", children: [_jsxs(Flex, { align: "center", gap: 2, flex: "1", minW: 0, overflow: "hidden", children: [_jsx(Icon, { as: item.icon, fontSize: SIDEBAR_ROW.iconSize, flexShrink: 0, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), _jsx(Box, { flex: "1", minW: 0, children: _jsx(OverflowTooltipText, { 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 && (_jsx(Badge, { ...softBadge(theme.colors, colorScheme, sidebarRowPeak(theme.colors.sidebar.background[500])), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal }))] }));
|
|
63
|
+
}, borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", transition: "background 0.12s", children: [_jsxs(Flex, { align: "center", gap: 2, flex: "1", minW: 0, overflow: "hidden", children: [_jsx(Icon, { as: item.icon, fontSize: SIDEBAR_ROW.iconSize, flexShrink: 0, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), _jsx(Box, { flex: "1", minW: 0, children: _jsx(OverflowTooltipText, { 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 ? (_jsx(Icon, { as: LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon })) : (badgeVal != null && (_jsx(Badge, { ...softBadge(theme.colors, colorScheme, sidebarRowPeak(theme.colors.sidebar.background[500])), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal })))] }));
|
|
64
|
+
return item.locked && item.lockedReason ? (_jsx(ToolTip, { label: item.lockedReason, placement: "top", children: row })) : (row);
|
|
60
65
|
};
|
|
61
66
|
const SecondaryBar = ({ items = [], defaultCollapsed = true, collapsedWidth = "3.5rem", expandedWidth = "10rem", headerFontSize = SIDEBAR_ROW.fontSize, itemFontSize = SIDEBAR_ROW.fontSize, selected, onItemClick, title, icon, }) => {
|
|
62
67
|
const theme = useCustomTheme();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useId } from "react";
|
|
2
|
+
import React, { useId } from "react";
|
|
3
3
|
import { Box, Flex, Icon, Popover, PopoverTrigger, PopoverContent, PopoverBody, Badge, Collapse, Portal, } from "@chakra-ui/react";
|
|
4
4
|
import MenuPopoverContent from "./MenuPopoverContent.js";
|
|
5
5
|
import { menuDisabled } from "../menuDisabled.js";
|
|
@@ -11,6 +11,7 @@ import { sidebarRowPeak } from "../../../Theme/tokens/builders/sidebarAccent.js"
|
|
|
11
11
|
import { scaleFor } from "../../../Theme/chakra/paletteFromTheme.js";
|
|
12
12
|
import TruncatedTextWithTooltip from "./TextTruncation.js";
|
|
13
13
|
import { sanitizeId } from "../sidebarId.js";
|
|
14
|
+
import ToolTip from "../../ToolTip/ToolTip.js";
|
|
14
15
|
import { SIDEBAR_ROW } from "../sidebarScale.js";
|
|
15
16
|
/**
|
|
16
17
|
* These rows are real `<a href>`s now, so the browser's own gestures have to keep working —
|
|
@@ -24,7 +25,7 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
|
|
|
24
25
|
const activeAccent = getSidebarActiveAccent(theme.colors);
|
|
25
26
|
// Never the raw label — keeps this id unique across multiple mounted SideBars too.
|
|
26
27
|
const reactId = sanitizeId(useId());
|
|
27
|
-
const { title, icon, locked, badge, subMenu, url } = menu;
|
|
28
|
+
const { title, icon, locked, lockedReason, badge, subMenu, url } = menu;
|
|
28
29
|
// `locked` blocks interaction the same as `disabled` — a locked item showing the padlock icon
|
|
29
30
|
// but still fully clickable was a real gotcha (see COMPONENT-GOTCHAS.md).
|
|
30
31
|
const isBlocked = menuDisabled(menu) || locked;
|
|
@@ -110,12 +111,13 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
|
|
|
110
111
|
handleToggleSubMenu(e);
|
|
111
112
|
}, "data-menu-id": String((_c = menu.id) !== null && _c !== void 0 ? _c : title), children: buttonContent }) }), _jsx(Portal, { children: _jsx(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: _jsx(PopoverBody, { p: "0.625rem", color: theme.colors.white, children: _jsx(MenuPopoverContent, { menu: menu, handleMenuClick: handleClick, activeMenu: activeMenu }) }) }) })] }));
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
const row = (_jsx(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) => {
|
|
115
|
+
if (!hasSubMenu && url && isBrowserNavigationGesture(e))
|
|
116
|
+
return;
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
handleToggleSubMenu(e);
|
|
119
|
+
}, "data-menu-id": String((_d = menu.id) !== null && _d !== void 0 ? _d : title), children: buttonContent }));
|
|
120
|
+
return (_jsxs(_Fragment, { children: [locked && lockedReason ? (_jsx(ToolTip, { label: lockedReason, placement: "top", children: row })) : (row), hasSubMenu && (_jsx(Collapse, { in: isOpen, animateOpacity: true, children: _jsx(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: {
|
|
119
121
|
transition: "opacity 0.28s ease, transform 0.28s ease",
|
|
120
122
|
opacity: isOpen ? 1 : 0,
|
|
121
123
|
transform: isOpen ? "translateY(0)" : "translateY(-6px)",
|
|
@@ -123,7 +125,8 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
|
|
|
123
125
|
var _a, _b, _c;
|
|
124
126
|
const isSubActive = activeMenu === sub.id;
|
|
125
127
|
const isSubBlocked = menuDisabled(sub) || sub.locked;
|
|
126
|
-
|
|
128
|
+
const subKey = `${String((_b = (_a = sub.id) !== null && _a !== void 0 ? _a : sub.title) !== null && _b !== void 0 ? _b : sIdx)}-${sIdx}`;
|
|
129
|
+
const subRow = (_jsxs(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: SIDEBAR_ROW.subHeight, pl: "28px", pr: "10px", borderRadius: "lg", fontSize: SIDEBAR_ROW.fontSize, borderLeft: "2px solid", borderLeftColor: isSubActive ? theme.colors.sidebar.activeIcon : "transparent", backgroundColor: isSubActive ? "whiteAlpha.300" : "transparent", _hover: {
|
|
127
130
|
backgroundColor: isSubBlocked
|
|
128
131
|
? "transparent"
|
|
129
132
|
: isSubActive
|
|
@@ -148,7 +151,8 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
|
|
|
148
151
|
const variant = (_d = subCfg === null || subCfg === void 0 ? void 0 : subCfg.variant) !== null && _d !== void 0 ? _d : "subtle";
|
|
149
152
|
const tone = resolveSoftTone(theme.colors, scaleFor(theme.colors, colorScheme), sidebarRowPeak(theme.colors.sidebar.background[500]));
|
|
150
153
|
return (_jsx(Badge, { bg: tone.bg, color: tone.fg, fontSize: "xs", variant: variant, borderRadius: radius, children: value }));
|
|
151
|
-
})()] }
|
|
154
|
+
})()] }));
|
|
155
|
+
return sub.locked && sub.lockedReason ? (_jsx(ToolTip, { label: sub.lockedReason, placement: "top", children: subRow }, subKey)) : (_jsx(React.Fragment, { children: subRow }, subKey));
|
|
152
156
|
}) }) }))] }));
|
|
153
157
|
};
|
|
154
158
|
export default MenuItemBox;
|
|
@@ -8,12 +8,13 @@ import { resolveSoftTone } from "../../../Theme/tokens/builders/tone.js";
|
|
|
8
8
|
import { sidebarRowPeak } from "../../../Theme/tokens/builders/sidebarAccent.js";
|
|
9
9
|
import { scaleFor } from "../../../Theme/chakra/paletteFromTheme.js";
|
|
10
10
|
import TruncatedTextWithTooltip from "./TextTruncation.js";
|
|
11
|
+
import ToolTip from "../../ToolTip/ToolTip.js";
|
|
11
12
|
import { SIDEBAR_ROW } from "../sidebarScale.js";
|
|
12
13
|
const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
|
|
13
14
|
var _a;
|
|
14
15
|
const theme = useCustomTheme();
|
|
15
16
|
const activeAccent = getSidebarActiveAccent(theme.colors);
|
|
16
|
-
const { title, icon, subMenu, badge, locked } = menu;
|
|
17
|
+
const { title, icon, subMenu, badge, locked, lockedReason } = menu;
|
|
17
18
|
const isBlocked = menuDisabled(menu) || locked;
|
|
18
19
|
const hasSubMenu = !!(subMenu === null || subMenu === void 0 ? void 0 : subMenu.length);
|
|
19
20
|
const isParentActive = activeMenu === menu.id;
|
|
@@ -38,7 +39,7 @@ const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
|
|
|
38
39
|
const variant = (_d = cfg === null || cfg === void 0 ? void 0 : cfg.variant) !== null && _d !== void 0 ? _d : "subtle";
|
|
39
40
|
const tone = resolveSoftTone(theme.colors, scaleFor(theme.colors, colorScheme), sidebarRowPeak(theme.colors.sidebar.elevated));
|
|
40
41
|
return (_jsx(Badge, { bg: tone.bg, color: tone.fg, fontSize: "xs", variant: variant, borderRadius: radius, children: value }));
|
|
41
|
-
})(), locked && _jsx(Icon, { as: LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon })] }), subMenu === null || subMenu === void 0 ? void 0 : subMenu.map((sub) => {
|
|
42
|
+
})(), locked && (lockedReason ? (_jsx(ToolTip, { label: lockedReason, placement: "top", children: _jsx(Icon, { as: LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon }) })) : (_jsx(Icon, { as: LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon })))] }), subMenu === null || subMenu === void 0 ? void 0 : subMenu.map((sub) => {
|
|
42
43
|
var _a;
|
|
43
44
|
const isSubActive = activeMenu === sub.id;
|
|
44
45
|
const isSubBlocked = menuDisabled(sub) || sub.locked;
|
|
@@ -49,7 +50,7 @@ const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
|
|
|
49
50
|
}, px: 2, h: 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: {
|
|
50
51
|
bg: isSubBlocked ? "transparent" : isSubActive ? "whiteAlpha.400" : "whiteAlpha.200",
|
|
51
52
|
cursor: !isSubBlocked ? "pointer" : "not-allowed",
|
|
52
|
-
}, opacity: isSubBlocked ? 0.5 : 1, pointerEvents: isSubBlocked ? "none" : "auto", transition: "background 0.12s", children: [_jsxs(Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [sub.icon ? (_jsx(Icon, { as: sub.icon, fontSize: SIDEBAR_ROW.iconSize, flexShrink: 0, color: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" })) : (_jsx(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" })), _jsx(TruncatedTextWithTooltip, { fontSize: 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 ? (_jsx(Icon, { as: LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon })) : (() => {
|
|
53
|
+
}, opacity: isSubBlocked ? 0.5 : 1, pointerEvents: isSubBlocked ? "none" : "auto", transition: "background 0.12s", children: [_jsxs(Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [sub.icon ? (_jsx(Icon, { as: sub.icon, fontSize: SIDEBAR_ROW.iconSize, flexShrink: 0, color: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" })) : (_jsx(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" })), _jsx(TruncatedTextWithTooltip, { fontSize: 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 ? (_jsx(ToolTip, { label: sub.lockedReason, placement: "top", children: _jsx(Icon, { as: LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon }) })) : (_jsx(Icon, { as: LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon }))) : (() => {
|
|
53
54
|
var _a, _b, _c, _d;
|
|
54
55
|
const cfg = typeof sub.badge === "object" && sub.badge !== null
|
|
55
56
|
? sub.badge
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useState } from "react";
|
|
3
|
+
import { Box, Flex } from "@chakra-ui/react";
|
|
4
|
+
import { ChevronDown } from "lucide-react";
|
|
5
|
+
import Button from "../Button/Button.js";
|
|
6
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
7
|
+
import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
|
|
8
|
+
import { reducedMotionSx } from "../../Theme/chakra/motion.js";
|
|
9
|
+
const DEFAULT_LABELS = { showAll: "Show all", showLess: "Show less" };
|
|
10
|
+
/** Definition list of specifications on striped tonal rows, with an optional "Show all" fold. */
|
|
11
|
+
const SpecTable = ({ items, columns = 1, collapsedCount, expanded, defaultExpanded = false, onExpandedChange, labels, "aria-label": ariaLabel, "data-testid": testId, }) => {
|
|
12
|
+
const { colors } = useCustomTheme();
|
|
13
|
+
const listId = useId();
|
|
14
|
+
const [inner, setInner] = useState(defaultExpanded);
|
|
15
|
+
const text = { ...DEFAULT_LABELS, ...labels };
|
|
16
|
+
if (items.length === 0)
|
|
17
|
+
return null;
|
|
18
|
+
const foldable = collapsedCount !== undefined && collapsedCount < items.length;
|
|
19
|
+
const isExpanded = expanded !== null && expanded !== void 0 ? expanded : inner;
|
|
20
|
+
const visible = foldable && !isExpanded ? items.slice(0, collapsedCount) : items;
|
|
21
|
+
const tint = colors.background[100];
|
|
22
|
+
const toggle = () => {
|
|
23
|
+
const next = !isExpanded;
|
|
24
|
+
if (expanded === undefined)
|
|
25
|
+
setInner(next);
|
|
26
|
+
onExpandedChange === null || onExpandedChange === void 0 ? void 0 : onExpandedChange(next);
|
|
27
|
+
};
|
|
28
|
+
return (_jsxs(Box, { "data-testid": testId, children: [_jsx(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) => {
|
|
29
|
+
const stripeNarrow = i % 2 === 0;
|
|
30
|
+
const stripeWide = columns === 2 ? Math.floor(i / 2) % 2 === 0 : stripeNarrow;
|
|
31
|
+
return (_jsxs(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: [_jsx(Box, { as: "dt", flex: "0 0 40%", minW: 0, color: colors.textMuted, overflowWrap: "anywhere", children: item.label }), _jsx(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}`));
|
|
32
|
+
}) }), foldable && (_jsx(Box, { mt: 2, children: _jsx(Button, { variant: "ghost", size: "sm", "aria-expanded": isExpanded, "aria-controls": listId, onClick: toggle, rightIcon: _jsx(Box, { as: "span", display: "inline-flex", transform: isExpanded ? "rotate(180deg)" : "rotate(0deg)", transition: transitionFor(["transform"]), sx: reducedMotionSx(), children: _jsx(ChevronDown, { size: 16, "aria-hidden": true }) }), children: isExpanded ? text.showLess : `${text.showAll} (${items.length})` }) }))] }));
|
|
33
|
+
};
|
|
34
|
+
export default SpecTable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,9 +11,9 @@ const SPINNER_SIZES = {
|
|
|
11
11
|
xl: { boxSize: "3rem", thickness: "0.25rem" },
|
|
12
12
|
};
|
|
13
13
|
/** Themed spinner for inline or panel loading; for a blocking overlay use Loading, for a button use Button isLoading. */
|
|
14
|
-
export default function Spinner({ size = "md", tone, color, label = "Loading", thickness, speed = "0.7s", emptyColor = "transparent", sx, ...rest }) {
|
|
14
|
+
export default function Spinner({ size = "md", tone, color, label = "Loading", thickness, speed = "0.7s", emptyColor = "transparent", sx, testId, ...rest }) {
|
|
15
15
|
const { colors } = useCustomTheme();
|
|
16
16
|
const spec = SPINNER_SIZES[size];
|
|
17
17
|
const ink = color !== null && color !== void 0 ? color : (tone ? toneInk(colors, tone) : colors.accentText);
|
|
18
|
-
return (_jsx(ChakraSpinner, { boxSize: spec.boxSize, ...rest, label: label, color: ink, emptyColor: emptyColor, thickness: thickness !== null && thickness !== void 0 ? thickness : spec.thickness, speed: speed, sx: { [REDUCED_MOTION_QUERY]: { animationDuration: "1.6s" }, ...sx } }));
|
|
18
|
+
return (_jsx(ChakraSpinner, { boxSize: spec.boxSize, ...rest, label: label, color: ink, emptyColor: emptyColor, thickness: thickness !== null && thickness !== void 0 ? thickness : spec.thickness, speed: speed, sx: { [REDUCED_MOTION_QUERY]: { animationDuration: "1.6s" }, ...sx }, ...(testId !== undefined ? { "data-testid": testId } : {}) }));
|
|
19
19
|
}
|
|
@@ -19,8 +19,9 @@ const StepperStage = ({ label, number, state, size = "md", colorScheme = "primar
|
|
|
19
19
|
const s = sizeMap[size];
|
|
20
20
|
const interactive = !isReadOnly && !disabled;
|
|
21
21
|
useEffect(() => {
|
|
22
|
+
var _a, _b;
|
|
22
23
|
if (state === "active" && scrollIntoViewWhenActive && ref.current) {
|
|
23
|
-
ref.current.scrollIntoView({
|
|
24
|
+
(_b = (_a = ref.current).scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
24
25
|
behavior: "smooth",
|
|
25
26
|
inline: "center",
|
|
26
27
|
block: "nearest",
|
|
@@ -8,7 +8,7 @@ import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
|
|
|
8
8
|
import Skeletons from "../Skeletons/Skeletons.js";
|
|
9
9
|
const StatCardSkeleton = ({ hasIcon }) => (_jsxs(Flex, { direction: "column", gap: 3, children: [_jsxs(Flex, { align: "center", gap: 2, children: [hasIcon && _jsx(Skeletons, { type: "skeleton", height: 8, width: 8 }), _jsx(Skeletons, { type: "skeleton", height: 3, width: "40%" })] }), _jsx(Skeletons, { type: "skeleton", height: 7, width: "55%" }), _jsx(Skeletons, { type: "skeleton", height: 3, width: "45%" })] }));
|
|
10
10
|
/** KPI tile: tinted icon chip, label, 2xl tabular value, delta coloured by whether the change is good. */
|
|
11
|
-
const StatCard = ({ label, value, delta, trend, goodDirection = "up", hint, icon: Icon, isLoading = false, onClick, "aria-label": ariaLabel, "data-testid": testId, }) => {
|
|
11
|
+
const StatCard = ({ label, value, delta, trend, goodDirection = "up", hint, sparkline, footer, icon: Icon, isLoading = false, onClick, "aria-label": ariaLabel, "data-testid": testId, }) => {
|
|
12
12
|
const { colors } = useCustomTheme();
|
|
13
13
|
const isInteractive = !!onClick && !isLoading;
|
|
14
14
|
const deltaColor = trend
|
|
@@ -28,7 +28,7 @@ const StatCard = ({ label, value, delta, trend, goodDirection = "up", hint, icon
|
|
|
28
28
|
px: 5,
|
|
29
29
|
py: 4,
|
|
30
30
|
};
|
|
31
|
-
const content = isLoading ? (_jsx(StatCardSkeleton, { hasIcon: !!Icon })) : (_jsxs(Flex, { as: "span", direction: "column", gap: 3, children: [_jsxs(Flex, { as: "span", align: "center", gap: 2, children: [Icon && (_jsx(Flex, { as: "span", boxSize: 8, flexShrink: 0, align: "center", justify: "center", borderRadius: "lg", bg: colors.primary.opacity[8], color: colors.accentText, children: _jsx(Icon, { size: 16, "aria-hidden": true }) })), _jsx(Text, { as: "span", fontSize: "xs", fontWeight: 500, color: colors.textMuted, children: label })] }), _jsx(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) && (_jsxs(Flex, { as: "span", align: "center", gap: 1.5, wrap: "wrap", children: [delta !== undefined && (_jsxs(Flex, { as: "span", align: "center", gap: 0.5, color: deltaColor, "data-testid": "stat-delta", children: [trend && _jsx(DeltaIcon, { size: 14, "aria-hidden": true }), trend && _jsx(VisuallyHidden, { children: trend === "up" ? "Up" : "Down" }), _jsx(Text, { as: "span", fontSize: "xs", fontWeight: 600, sx: { fontVariantNumeric: "tabular-nums" }, children: delta })] })), hint && (_jsx(Text, { as: "span", fontSize: "xs", color: colors.textMuted, children: hint }))] }))] }));
|
|
31
|
+
const content = isLoading ? (_jsx(StatCardSkeleton, { hasIcon: !!Icon })) : (_jsxs(Flex, { as: "span", direction: "column", gap: 3, children: [_jsxs(Flex, { as: "span", align: "center", gap: 2, children: [Icon && (_jsx(Flex, { as: "span", boxSize: 8, flexShrink: 0, align: "center", justify: "center", borderRadius: "lg", bg: colors.primary.opacity[8], color: colors.accentText, children: _jsx(Icon, { size: 16, "aria-hidden": true }) })), _jsx(Text, { as: "span", fontSize: "xs", fontWeight: 500, color: colors.textMuted, children: label })] }), _jsxs(Flex, { as: "span", align: "center", justify: "space-between", gap: 3, children: [_jsx(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 && (_jsx(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) && (_jsxs(Flex, { as: "span", align: "center", gap: 1.5, wrap: "wrap", children: [delta !== undefined && (_jsxs(Flex, { as: "span", align: "center", gap: 0.5, color: deltaColor, "data-testid": "stat-delta", children: [trend && _jsx(DeltaIcon, { size: 14, "aria-hidden": true }), trend && _jsx(VisuallyHidden, { children: trend === "up" ? "Up" : "Down" }), _jsx(Text, { as: "span", fontSize: "xs", fontWeight: 600, sx: { fontVariantNumeric: "tabular-nums" }, children: delta })] })), hint && (_jsx(Text, { as: "span", fontSize: "xs", color: colors.textMuted, children: hint }))] })), footer && (_jsx(Box, { as: "span", pt: 3, borderTopWidth: "1px", borderColor: colors.boxborder[200], "data-testid": "stat-footer", children: footer }))] }));
|
|
32
32
|
if (!isInteractive) {
|
|
33
33
|
return (_jsx(Box, { ...surface, "aria-busy": isLoading || undefined, "data-testid": testId, children: content }));
|
|
34
34
|
}
|