pixelize-design-library 2.4.2-beta.55 → 2.4.2-beta.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/COMPONENT-GOTCHAS.md +50 -22
  3. package/DESIGN-GUIDE.md +19 -2
  4. package/dist/Components/AddressCard/AddressCard.d.ts +4 -0
  5. package/dist/Components/AddressCard/AddressCard.js +25 -0
  6. package/dist/Components/AddressCard/AddressCardGroup.d.ts +4 -0
  7. package/dist/Components/AddressCard/AddressCardGroup.js +7 -0
  8. package/dist/Components/AddressCard/AddressCardProps.d.ts +43 -0
  9. package/dist/Components/AddressCard/AddressCardProps.js +2 -0
  10. package/dist/Components/BagBar/BagBar.d.ts +4 -0
  11. package/dist/Components/BagBar/BagBar.js +32 -0
  12. package/dist/Components/BagBar/BagBarProps.d.ts +30 -0
  13. package/dist/Components/BagBar/BagBarProps.js +2 -0
  14. package/dist/Components/CartItem/CartItem.d.ts +4 -0
  15. package/dist/Components/CartItem/CartItem.js +60 -0
  16. package/dist/Components/CartItem/CartItemProps.d.ts +64 -0
  17. package/dist/Components/CartItem/CartItemProps.js +2 -0
  18. package/dist/Components/CartItem/cartItemOptions.d.ts +3 -0
  19. package/dist/Components/CartItem/cartItemOptions.js +13 -0
  20. package/dist/Components/CheckoutKit/selectable.d.ts +58 -0
  21. package/dist/Components/CheckoutKit/selectable.js +120 -0
  22. package/dist/Components/Commerce/commerceTypes.d.ts +52 -0
  23. package/dist/Components/Commerce/commerceTypes.js +2 -0
  24. package/dist/Components/Commerce/commerceVariants.d.ts +13 -0
  25. package/dist/Components/Commerce/commerceVariants.js +51 -0
  26. package/dist/Components/Commerce/index.d.ts +2 -0
  27. package/dist/Components/Commerce/index.js +18 -0
  28. package/dist/Components/Commerce/useContainerWidth.d.ts +3 -0
  29. package/dist/Components/Commerce/useContainerWidth.js +25 -0
  30. package/dist/Components/CouponField/CouponField.d.ts +4 -0
  31. package/dist/Components/CouponField/CouponField.js +72 -0
  32. package/dist/Components/CouponField/CouponFieldProps.d.ts +49 -0
  33. package/dist/Components/CouponField/CouponFieldProps.js +2 -0
  34. package/dist/Components/DatePicker/DatePickerProps.d.ts +1 -1
  35. package/dist/Components/DatePicker/PickerPortal.d.ts +11 -0
  36. package/dist/Components/DatePicker/PickerPortal.js +26 -0
  37. package/dist/Components/DatePicker/RangeDatePicker.d.ts +1 -1
  38. package/dist/Components/DatePicker/RangeDatePicker.js +67 -32
  39. package/dist/Components/DatePicker/SingleDatePicker.js +49 -13
  40. package/dist/Components/DatePicker/TimeOnlyPicker.js +39 -4
  41. package/dist/Components/DetailSections/DetailSections.d.ts +4 -0
  42. package/dist/Components/DetailSections/DetailSections.js +112 -0
  43. package/dist/Components/DetailSections/DetailSectionsProps.d.ts +58 -0
  44. package/dist/Components/DetailSections/DetailSectionsProps.js +2 -0
  45. package/dist/Components/Input/PhoneNumberInputProps.d.ts +1 -1
  46. package/dist/Components/MediaGallery/MediaFrame.d.ts +31 -0
  47. package/dist/Components/MediaGallery/MediaFrame.js +55 -0
  48. package/dist/Components/MediaGallery/MediaGallery.d.ts +4 -0
  49. package/dist/Components/MediaGallery/MediaGallery.js +206 -0
  50. package/dist/Components/MediaGallery/MediaGalleryProps.d.ts +76 -0
  51. package/dist/Components/MediaGallery/MediaGalleryProps.js +20 -0
  52. package/dist/Components/MediaGallery/MediaLightbox.d.ts +4 -0
  53. package/dist/Components/MediaGallery/MediaLightbox.js +116 -0
  54. package/dist/Components/MediaGallery/MediaLightboxProps.d.ts +40 -0
  55. package/dist/Components/MediaGallery/MediaLightboxProps.js +15 -0
  56. package/dist/Components/MediaGallery/MediaThumb.d.ts +18 -0
  57. package/dist/Components/MediaGallery/MediaThumb.js +25 -0
  58. package/dist/Components/MediaGallery/glass.d.ts +31 -0
  59. package/dist/Components/MediaGallery/glass.js +47 -0
  60. package/dist/Components/MediaGallery/mediaGalleryModel.d.ts +22 -0
  61. package/dist/Components/MediaGallery/mediaGalleryModel.js +83 -0
  62. package/dist/Components/MediaGallery/motion.d.ts +5 -0
  63. package/dist/Components/MediaGallery/motion.js +12 -0
  64. package/dist/Components/MediaGallery/useMatchMedia.d.ts +2 -0
  65. package/dist/Components/MediaGallery/useMatchMedia.js +20 -0
  66. package/dist/Components/MultiSelect/MultiSelectProps.d.ts +1 -1
  67. package/dist/Components/OffersList/OffersList.d.ts +4 -0
  68. package/dist/Components/OffersList/OffersList.js +83 -0
  69. package/dist/Components/OffersList/OffersListProps.d.ts +34 -0
  70. package/dist/Components/OffersList/OffersListProps.js +2 -0
  71. package/dist/Components/OptionChip/OptionChip.d.ts +4 -0
  72. package/dist/Components/OptionChip/OptionChip.js +97 -0
  73. package/dist/Components/OptionChip/OptionChipProps.d.ts +33 -0
  74. package/dist/Components/OptionChip/OptionChipProps.js +2 -0
  75. package/dist/Components/OptionChip/optionInk.d.ts +12 -0
  76. package/dist/Components/OptionChip/optionInk.js +25 -0
  77. package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.d.ts +4 -0
  78. package/dist/Components/OrderStatusTimeline/OrderStatusTimeline.js +57 -0
  79. package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.d.ts +29 -0
  80. package/dist/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +2 -0
  81. package/dist/Components/OrderSummary/OrderSummary.d.ts +4 -0
  82. package/dist/Components/OrderSummary/OrderSummary.js +63 -0
  83. package/dist/Components/OrderSummary/OrderSummaryProps.d.ts +53 -0
  84. package/dist/Components/OrderSummary/OrderSummaryProps.js +2 -0
  85. package/dist/Components/PaymentOption/PaymentOption.d.ts +4 -0
  86. package/dist/Components/PaymentOption/PaymentOption.js +24 -0
  87. package/dist/Components/PaymentOption/PaymentOptionGroup.d.ts +4 -0
  88. package/dist/Components/PaymentOption/PaymentOptionGroup.js +7 -0
  89. package/dist/Components/PaymentOption/PaymentOptionProps.d.ts +32 -0
  90. package/dist/Components/PaymentOption/PaymentOptionProps.js +2 -0
  91. package/dist/Components/PinInput/PinInputProps.d.ts +1 -1
  92. package/dist/Components/PincodeChecker/PincodeChecker.d.ts +4 -0
  93. package/dist/Components/PincodeChecker/PincodeChecker.js +175 -0
  94. package/dist/Components/PincodeChecker/PincodeCheckerProps.d.ts +57 -0
  95. package/dist/Components/PincodeChecker/PincodeCheckerProps.js +2 -0
  96. package/dist/Components/PriceBlock/PriceBlock.d.ts +4 -0
  97. package/dist/Components/PriceBlock/PriceBlock.js +41 -0
  98. package/dist/Components/PriceBlock/PriceBlockProps.d.ts +39 -0
  99. package/dist/Components/PriceBlock/PriceBlockProps.js +2 -0
  100. package/dist/Components/ProductBadges/ProductBadges.d.ts +4 -0
  101. package/dist/Components/ProductBadges/ProductBadges.js +61 -0
  102. package/dist/Components/ProductBadges/ProductBadgesProps.d.ts +18 -0
  103. package/dist/Components/ProductBadges/ProductBadgesProps.js +2 -0
  104. package/dist/Components/ProductCard/ProductCard.d.ts +3 -2
  105. package/dist/Components/ProductCard/ProductCard.js +103 -52
  106. package/dist/Components/ProductCard/ProductCardAction.d.ts +17 -0
  107. package/dist/Components/ProductCard/ProductCardAction.js +65 -0
  108. package/dist/Components/ProductCard/ProductCardGrid.d.ts +4 -0
  109. package/dist/Components/ProductCard/ProductCardGrid.js +20 -0
  110. package/dist/Components/ProductCard/ProductCardMedia.d.ts +18 -0
  111. package/dist/Components/ProductCard/ProductCardMedia.js +35 -0
  112. package/dist/Components/ProductCard/ProductCardProps.d.ts +138 -56
  113. package/dist/Components/ProductCard/ProductCardSkeleton.d.ts +4 -0
  114. package/dist/Components/ProductCard/ProductCardSkeleton.js +17 -0
  115. package/dist/Components/ProductCard/ProductCardSwatches.d.ts +15 -0
  116. package/dist/Components/ProductCard/ProductCardSwatches.js +37 -0
  117. package/dist/Components/ProductCard/QuickAddSheet.d.ts +4 -0
  118. package/dist/Components/ProductCard/QuickAddSheet.js +109 -0
  119. package/dist/Components/ProductCard/QuickAddSheetProps.d.ts +38 -0
  120. package/dist/Components/ProductCard/QuickAddSheetProps.js +2 -0
  121. package/dist/Components/ProductCard/cardLabels.d.ts +2 -0
  122. package/dist/Components/ProductCard/cardLabels.js +16 -0
  123. package/dist/Components/ProductCard/cardMetrics.d.ts +27 -0
  124. package/dist/Components/ProductCard/cardMetrics.js +55 -0
  125. package/dist/Components/ProductCard/productCardFixtures.d.ts +7 -0
  126. package/dist/Components/ProductCard/productCardFixtures.js +61 -0
  127. package/dist/Components/ProductCard/productCardModel.d.ts +22 -0
  128. package/dist/Components/ProductCard/productCardModel.js +79 -0
  129. package/dist/Components/ProductCard/useMinWidth.d.ts +2 -0
  130. package/dist/Components/ProductCard/useMinWidth.js +20 -0
  131. package/dist/Components/ProductDetails/ProductDetails.d.ts +3 -2
  132. package/dist/Components/ProductDetails/ProductDetails.js +209 -33
  133. package/dist/Components/ProductDetails/ProductDetailsProps.d.ts +143 -41
  134. package/dist/Components/ProductDetails/productDetailsModel.d.ts +14 -0
  135. package/dist/Components/ProductDetails/productDetailsModel.js +45 -0
  136. package/dist/Components/ProductDetails/useInViewport.d.ts +3 -0
  137. package/dist/Components/ProductDetails/useInViewport.js +18 -0
  138. package/dist/Components/QuantityStepper/QuantityStepper.d.ts +4 -0
  139. package/dist/Components/QuantityStepper/QuantityStepper.js +59 -0
  140. package/dist/Components/QuantityStepper/QuantityStepperProps.d.ts +24 -0
  141. package/dist/Components/QuantityStepper/QuantityStepperProps.js +2 -0
  142. package/dist/Components/Rating/Rating.d.ts +4 -0
  143. package/dist/Components/Rating/Rating.js +81 -0
  144. package/dist/Components/Rating/RatingProps.d.ts +27 -0
  145. package/dist/Components/Rating/RatingProps.js +2 -0
  146. package/dist/Components/ReviewList/ReviewList.d.ts +4 -0
  147. package/dist/Components/ReviewList/ReviewList.js +94 -0
  148. package/dist/Components/ReviewList/ReviewListProps.d.ts +68 -0
  149. package/dist/Components/ReviewList/ReviewListProps.js +2 -0
  150. package/dist/Components/ReviewSummary/ReviewSummary.d.ts +4 -0
  151. package/dist/Components/ReviewSummary/ReviewSummary.js +47 -0
  152. package/dist/Components/ReviewSummary/ReviewSummaryProps.d.ts +31 -0
  153. package/dist/Components/ReviewSummary/ReviewSummaryProps.js +2 -0
  154. package/dist/Components/Search/SearchProps.d.ts +1 -1
  155. package/dist/Components/SearchSelect/SearchSelectProps.d.ts +1 -1
  156. package/dist/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
  157. package/dist/Components/SegmentedControl/SegmentedControl.js +17 -5
  158. package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +6 -0
  159. package/dist/Components/SegmentedControl/segmentedInk.d.ts +2 -0
  160. package/dist/Components/SegmentedControl/segmentedInk.js +4 -1
  161. package/dist/Components/SegmentedControl/useSlidingPill.d.ts +2 -0
  162. package/dist/Components/SegmentedControl/useSlidingPill.js +6 -1
  163. package/dist/Components/Select/SelectProps.d.ts +1 -1
  164. package/dist/Components/SelectSearch/SelectSearchProps.d.ts +1 -1
  165. package/dist/Components/SelectV2/SelectV2Props.d.ts +1 -1
  166. package/dist/Components/SideBar/SecondaryBar.js +13 -8
  167. package/dist/Components/SideBar/SideBarProps.d.ts +3 -1
  168. package/dist/Components/SideBar/components/MenuItemBox.js +47 -10
  169. package/dist/Components/SideBar/components/MenuPopoverContent.js +4 -3
  170. package/dist/Components/SpecTable/SpecTable.d.ts +4 -0
  171. package/dist/Components/SpecTable/SpecTable.js +39 -0
  172. package/dist/Components/SpecTable/SpecTableProps.d.ts +25 -0
  173. package/dist/Components/SpecTable/SpecTableProps.js +2 -0
  174. package/dist/Components/Spinner/Spinner.d.ts +1 -1
  175. package/dist/Components/Spinner/Spinner.js +2 -2
  176. package/dist/Components/Spinner/SpinnerProps.d.ts +2 -0
  177. package/dist/Components/StageProgress/StepperStage.js +2 -1
  178. package/dist/Components/StatCard/StatCard.d.ts +1 -1
  179. package/dist/Components/StatCard/StatCard.js +2 -2
  180. package/dist/Components/StatCard/StatCardProps.d.ts +4 -0
  181. package/dist/Components/StickyBuyBar/StickyBuyBar.d.ts +3 -0
  182. package/dist/Components/StickyBuyBar/StickyBuyBar.js +85 -0
  183. package/dist/Components/StickyBuyBar/StickyBuyBarProps.d.ts +54 -0
  184. package/dist/Components/StickyBuyBar/StickyBuyBarProps.js +2 -0
  185. package/dist/Components/StockStatus/StockStatus.d.ts +4 -0
  186. package/dist/Components/StockStatus/StockStatus.js +31 -0
  187. package/dist/Components/StockStatus/StockStatusProps.d.ts +14 -0
  188. package/dist/Components/StockStatus/StockStatusProps.js +2 -0
  189. package/dist/Components/Table/Table.js +2 -1
  190. package/dist/Components/Table/TableProps.d.ts +5 -2
  191. package/dist/Components/Table/columnLabel.d.ts +6 -0
  192. package/dist/Components/Table/columnLabel.js +27 -0
  193. package/dist/Components/Table/components/TableBody.js +5 -1
  194. package/dist/Components/Table/components/TableHeader.js +3 -2
  195. package/dist/Components/Table/filters/ActiveFilters.js +2 -1
  196. package/dist/Components/Table/filters/TableFilters.js +2 -1
  197. package/dist/Components/Table/hooks/useTable.js +3 -2
  198. package/dist/Components/Table/settings/ManageColumns.js +4 -3
  199. package/dist/Components/Table/settings/TableSettings.js +2 -1
  200. package/dist/Components/TrustBadges/TrustBadges.d.ts +4 -0
  201. package/dist/Components/TrustBadges/TrustBadges.js +24 -0
  202. package/dist/Components/TrustBadges/TrustBadgesProps.d.ts +20 -0
  203. package/dist/Components/TrustBadges/TrustBadgesProps.js +2 -0
  204. package/dist/Components/VariantSelector/VariantSelector.d.ts +4 -0
  205. package/dist/Components/VariantSelector/VariantSelector.js +123 -0
  206. package/dist/Components/VariantSelector/VariantSelectorProps.d.ts +27 -0
  207. package/dist/Components/VariantSelector/VariantSelectorProps.js +2 -0
  208. package/dist/Components/VariantSelector/variantSelection.d.ts +6 -0
  209. package/dist/Components/VariantSelector/variantSelection.js +25 -0
  210. package/dist/Components/WishlistToggle/WishlistToggle.d.ts +4 -0
  211. package/dist/Components/WishlistToggle/WishlistToggle.js +65 -0
  212. package/dist/Components/WishlistToggle/WishlistToggleProps.d.ts +19 -0
  213. package/dist/Components/WishlistToggle/WishlistToggleProps.js +2 -0
  214. package/dist/Theme/assertPalette.d.ts +1 -1
  215. package/dist/Theme/assertPalette.js +1 -1
  216. package/dist/Theme/tokens/brands/index.js +2 -0
  217. package/dist/Theme/tokens/brands/zinc/palette.dark.d.ts +1 -0
  218. package/dist/Theme/tokens/builders/buildDarkPalette.js +2 -0
  219. package/dist/Theme/tokens/builders/index.d.ts +1 -0
  220. package/dist/Theme/tokens/builders/index.js +1 -0
  221. package/dist/Theme/tokens/builders/rechartsTheme.d.ts +56 -0
  222. package/dist/Theme/tokens/builders/rechartsTheme.js +43 -0
  223. package/dist/Theme/tokens/builders/star.d.ts +3 -0
  224. package/dist/Theme/tokens/builders/star.js +8 -0
  225. package/dist/Theme/tokens/primitives/controlSizes.js +1 -1
  226. package/dist/Theme/tokens/types.d.ts +3 -1
  227. package/dist/Theme/useChartTheme.d.ts +4 -0
  228. package/dist/Theme/useChartTheme.js +12 -0
  229. package/dist/Utils/price.d.ts +16 -0
  230. package/dist/Utils/price.js +34 -0
  231. package/dist/esm/Components/AddressCard/AddressCard.js +20 -0
  232. package/dist/esm/Components/AddressCard/AddressCardGroup.js +5 -0
  233. package/dist/esm/Components/AddressCard/AddressCardProps.js +1 -0
  234. package/dist/esm/Components/BagBar/BagBar.js +27 -0
  235. package/dist/esm/Components/BagBar/BagBarProps.js +1 -0
  236. package/dist/esm/Components/CartItem/CartItem.js +55 -0
  237. package/dist/esm/Components/CartItem/CartItemProps.js +1 -0
  238. package/dist/esm/Components/CartItem/cartItemOptions.js +9 -0
  239. package/dist/esm/Components/CheckoutKit/selectable.js +112 -0
  240. package/dist/esm/Components/Commerce/commerceTypes.js +1 -0
  241. package/dist/esm/Components/Commerce/commerceVariants.js +41 -0
  242. package/dist/esm/Components/Commerce/index.js +2 -0
  243. package/dist/esm/Components/Commerce/useContainerWidth.js +21 -0
  244. package/dist/esm/Components/CouponField/CouponField.js +67 -0
  245. package/dist/esm/Components/CouponField/CouponFieldProps.js +1 -0
  246. package/dist/esm/Components/DatePicker/PickerPortal.js +21 -0
  247. package/dist/esm/Components/DatePicker/RangeDatePicker.js +34 -32
  248. package/dist/esm/Components/DatePicker/SingleDatePicker.js +16 -13
  249. package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +6 -4
  250. package/dist/esm/Components/DetailSections/DetailSections.js +107 -0
  251. package/dist/esm/Components/DetailSections/DetailSectionsProps.js +1 -0
  252. package/dist/esm/Components/MediaGallery/MediaFrame.js +48 -0
  253. package/dist/esm/Components/MediaGallery/MediaGallery.js +201 -0
  254. package/dist/esm/Components/MediaGallery/MediaGalleryProps.js +17 -0
  255. package/dist/esm/Components/MediaGallery/MediaLightbox.js +78 -0
  256. package/dist/esm/Components/MediaGallery/MediaLightboxProps.js +12 -0
  257. package/dist/esm/Components/MediaGallery/MediaThumb.js +23 -0
  258. package/dist/esm/Components/MediaGallery/glass.js +42 -0
  259. package/dist/esm/Components/MediaGallery/mediaGalleryModel.js +71 -0
  260. package/dist/esm/Components/MediaGallery/motion.js +8 -0
  261. package/dist/esm/Components/MediaGallery/useMatchMedia.js +16 -0
  262. package/dist/esm/Components/OffersList/OffersList.js +81 -0
  263. package/dist/esm/Components/OffersList/OffersListProps.js +1 -0
  264. package/dist/esm/Components/OptionChip/OptionChip.js +95 -0
  265. package/dist/esm/Components/OptionChip/OptionChipProps.js +1 -0
  266. package/dist/esm/Components/OptionChip/optionInk.js +21 -0
  267. package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimeline.js +55 -0
  268. package/dist/esm/Components/OrderStatusTimeline/OrderStatusTimelineProps.js +1 -0
  269. package/dist/esm/Components/OrderSummary/OrderSummary.js +58 -0
  270. package/dist/esm/Components/OrderSummary/OrderSummaryProps.js +1 -0
  271. package/dist/esm/Components/PaymentOption/PaymentOption.js +19 -0
  272. package/dist/esm/Components/PaymentOption/PaymentOptionGroup.js +5 -0
  273. package/dist/esm/Components/PaymentOption/PaymentOptionProps.js +1 -0
  274. package/dist/esm/Components/PincodeChecker/PincodeChecker.js +170 -0
  275. package/dist/esm/Components/PincodeChecker/PincodeCheckerProps.js +1 -0
  276. package/dist/esm/Components/PriceBlock/PriceBlock.js +39 -0
  277. package/dist/esm/Components/PriceBlock/PriceBlockProps.js +1 -0
  278. package/dist/esm/Components/ProductBadges/ProductBadges.js +59 -0
  279. package/dist/esm/Components/ProductBadges/ProductBadgesProps.js +1 -0
  280. package/dist/esm/Components/ProductCard/ProductCard.js +105 -54
  281. package/dist/esm/Components/ProductCard/ProductCardAction.js +60 -0
  282. package/dist/esm/Components/ProductCard/ProductCardGrid.js +18 -0
  283. package/dist/esm/Components/ProductCard/ProductCardMedia.js +33 -0
  284. package/dist/esm/Components/ProductCard/ProductCardSkeleton.js +12 -0
  285. package/dist/esm/Components/ProductCard/ProductCardSwatches.js +35 -0
  286. package/dist/esm/Components/ProductCard/QuickAddSheet.js +71 -0
  287. package/dist/esm/Components/ProductCard/QuickAddSheetProps.js +1 -0
  288. package/dist/esm/Components/ProductCard/cardLabels.js +13 -0
  289. package/dist/esm/Components/ProductCard/cardMetrics.js +52 -0
  290. package/dist/esm/Components/ProductCard/productCardFixtures.js +58 -0
  291. package/dist/esm/Components/ProductCard/productCardModel.js +65 -0
  292. package/dist/esm/Components/ProductCard/useMinWidth.js +16 -0
  293. package/dist/esm/Components/ProductDetails/ProductDetails.js +210 -34
  294. package/dist/esm/Components/ProductDetails/productDetailsModel.js +35 -0
  295. package/dist/esm/Components/ProductDetails/useInViewport.js +14 -0
  296. package/dist/esm/Components/QuantityStepper/QuantityStepper.js +57 -0
  297. package/dist/esm/Components/QuantityStepper/QuantityStepperProps.js +1 -0
  298. package/dist/esm/Components/Rating/Rating.js +79 -0
  299. package/dist/esm/Components/Rating/RatingProps.js +1 -0
  300. package/dist/esm/Components/ReviewList/ReviewList.js +89 -0
  301. package/dist/esm/Components/ReviewList/ReviewListProps.js +1 -0
  302. package/dist/esm/Components/ReviewSummary/ReviewSummary.js +42 -0
  303. package/dist/esm/Components/ReviewSummary/ReviewSummaryProps.js +1 -0
  304. package/dist/esm/Components/SegmentedControl/SegmentedControl.js +19 -7
  305. package/dist/esm/Components/SegmentedControl/segmentedInk.js +2 -0
  306. package/dist/esm/Components/SegmentedControl/useSlidingPill.js +6 -1
  307. package/dist/esm/Components/SideBar/SecondaryBar.js +14 -9
  308. package/dist/esm/Components/SideBar/components/MenuItemBox.js +14 -10
  309. package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +4 -3
  310. package/dist/esm/Components/SpecTable/SpecTable.js +34 -0
  311. package/dist/esm/Components/SpecTable/SpecTableProps.js +1 -0
  312. package/dist/esm/Components/Spinner/Spinner.js +2 -2
  313. package/dist/esm/Components/StageProgress/StepperStage.js +2 -1
  314. package/dist/esm/Components/StatCard/StatCard.js +2 -2
  315. package/dist/esm/Components/StickyBuyBar/StickyBuyBar.js +80 -0
  316. package/dist/esm/Components/StickyBuyBar/StickyBuyBarProps.js +1 -0
  317. package/dist/esm/Components/StockStatus/StockStatus.js +29 -0
  318. package/dist/esm/Components/StockStatus/StockStatusProps.js +1 -0
  319. package/dist/esm/Components/Table/Table.js +2 -1
  320. package/dist/esm/Components/Table/columnLabel.js +21 -0
  321. package/dist/esm/Components/Table/components/TableBody.js +5 -1
  322. package/dist/esm/Components/Table/components/TableHeader.js +3 -2
  323. package/dist/esm/Components/Table/filters/ActiveFilters.js +2 -1
  324. package/dist/esm/Components/Table/filters/TableFilters.js +2 -1
  325. package/dist/esm/Components/Table/hooks/useTable.js +3 -2
  326. package/dist/esm/Components/Table/settings/ManageColumns.js +4 -3
  327. package/dist/esm/Components/Table/settings/TableSettings.js +2 -1
  328. package/dist/esm/Components/TrustBadges/TrustBadges.js +22 -0
  329. package/dist/esm/Components/TrustBadges/TrustBadgesProps.js +1 -0
  330. package/dist/esm/Components/VariantSelector/VariantSelector.js +118 -0
  331. package/dist/esm/Components/VariantSelector/VariantSelectorProps.js +1 -0
  332. package/dist/esm/Components/VariantSelector/variantSelection.js +19 -0
  333. package/dist/esm/Components/WishlistToggle/WishlistToggle.js +63 -0
  334. package/dist/esm/Components/WishlistToggle/WishlistToggleProps.js +1 -0
  335. package/dist/esm/Theme/assertPalette.js +1 -1
  336. package/dist/esm/Theme/tokens/brands/index.js +2 -0
  337. package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +2 -0
  338. package/dist/esm/Theme/tokens/builders/index.js +1 -0
  339. package/dist/esm/Theme/tokens/builders/rechartsTheme.js +37 -0
  340. package/dist/esm/Theme/tokens/builders/star.js +4 -0
  341. package/dist/esm/Theme/tokens/primitives/controlSizes.js +1 -1
  342. package/dist/esm/Theme/useChartTheme.js +8 -0
  343. package/dist/esm/Utils/price.js +27 -0
  344. package/dist/esm/index.js +36 -0
  345. package/dist/index.d.ts +66 -0
  346. package/dist/index.js +86 -4
  347. package/package.json +1 -1
  348. package/dist/Components/ProductCard/ProductLabel.d.ts +0 -7
  349. package/dist/Components/ProductCard/ProductLabel.js +0 -20
  350. package/dist/Components/ProductCard/ProductPrice.d.ts +0 -10
  351. package/dist/Components/ProductCard/ProductPrice.js +0 -126
  352. package/dist/Components/ProductCard/ProductReview.d.ts +0 -8
  353. package/dist/Components/ProductCard/ProductReview.js +0 -30
  354. package/dist/Components/ProductCard/ProductTags.d.ts +0 -8
  355. package/dist/Components/ProductCard/ProductTags.js +0 -53
  356. package/dist/Components/ProductDetails/ProductDtlPrice.d.ts +0 -7
  357. package/dist/Components/ProductDetails/ProductDtlPrice.js +0 -24
  358. package/dist/Components/ProductDetails/ProductImageSlider.d.ts +0 -13
  359. package/dist/Components/ProductDetails/ProductImageSlider.js +0 -240
  360. package/dist/esm/Components/ProductCard/ProductLabel.js +0 -18
  361. package/dist/esm/Components/ProductCard/ProductPrice.js +0 -121
  362. package/dist/esm/Components/ProductCard/ProductReview.js +0 -28
  363. package/dist/esm/Components/ProductCard/ProductTags.js +0 -48
  364. package/dist/esm/Components/ProductDetails/ProductDtlPrice.js +0 -22
  365. package/dist/esm/Components/ProductDetails/ProductImageSlider.js +0 -204
@@ -0,0 +1,35 @@
1
+ import { stockState } from "../Commerce/commerceVariants.js";
2
+ import { unitPrice } from "../../Utils/price.js";
3
+ export const DEFAULT_MAX_QUANTITY = 10;
4
+ /** A product without variants sells as one variant at its own price. */
5
+ export const resolveVariants = (product) => product.variants.length > 0
6
+ ? product.variants
7
+ : [{ id: "default", options: {}, price: product.price, mrp: product.mrp }];
8
+ /** A variant's own frames win; otherwise the frames of each picked option, in axis order. */
9
+ export const activeMediaIds = (product, selection, variant) => {
10
+ if ((variant === null || variant === void 0 ? void 0 : variant.mediaIds) && variant.mediaIds.length > 0)
11
+ return variant.mediaIds;
12
+ const byOption = product.mediaIdsByOption;
13
+ if (!byOption)
14
+ return undefined;
15
+ const ids = product.axes.flatMap((axis) => { var _a; return (_a = byOption[`${axis.id}:${selection[axis.id]}`]) !== null && _a !== void 0 ? _a : []; });
16
+ return ids.length > 0 ? [...new Set(ids)] : undefined;
17
+ };
18
+ export const packUnitPrice = (product, selection, price) => {
19
+ if (!product.unit)
20
+ return null;
21
+ const axis = product.axes.find((candidate) => candidate.type === "pack");
22
+ const picked = axis === null || axis === void 0 ? void 0 : axis.values.find((value) => value.id === selection[axis.id]);
23
+ if (!(picked === null || picked === void 0 ? void 0 : picked.quantity))
24
+ return null;
25
+ return unitPrice(price, picked.quantity, product.unit.unit, product.unit.per);
26
+ };
27
+ export const firstUnpickedAxis = (axes, selection) => axes.find((axis) => selection[axis.id] === undefined);
28
+ export const soldOutEverywhere = (variants) => variants.length > 0 && variants.every((variant) => stockState(variant) === "out-of-stock");
29
+ /** Real remaining stock caps the order; backorder and untracked stock fall back to the per-order ceiling. */
30
+ export const quantityCeiling = (variant, maxQuantity) => {
31
+ if ((variant === null || variant === void 0 ? void 0 : variant.stock) === undefined || variant.backorder)
32
+ return maxQuantity;
33
+ return Math.max(0, Math.min(variant.stock, maxQuantity));
34
+ };
35
+ export const clampQuantity = (value, ceiling) => Math.max(1, Math.min(value, Math.max(1, ceiling)));
@@ -0,0 +1,14 @@
1
+ import { useEffect, useState } from "react";
2
+ /** Whether the element is on screen; true until an observer reports otherwise, and always true where IntersectionObserver is missing. */
3
+ export const useInViewport = (ref, enabled = true) => {
4
+ const [inView, setInView] = useState(true);
5
+ useEffect(() => {
6
+ const node = ref.current;
7
+ if (!enabled || !node || typeof IntersectionObserver === "undefined")
8
+ return undefined;
9
+ const observer = new IntersectionObserver(([entry]) => setInView(entry.isIntersecting));
10
+ observer.observe(node);
11
+ return () => observer.disconnect();
12
+ }, [ref, enabled]);
13
+ return inView;
14
+ };
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Box, Flex, Text } from "@chakra-ui/react";
4
+ import { Minus, Plus, Trash2 } from "lucide-react";
5
+ import { useCustomTheme } from "../../Theme/useCustomTheme.js";
6
+ import { BUTTON_SIZES } from "../../Theme/tokens/primitives/controlSizes.js";
7
+ import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
8
+ import { reducedMotionSx } from "../../Theme/chakra/motion.js";
9
+ import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
10
+ const MIN_HIT = "2.75rem";
11
+ const LIMIT_OPACITY = 0.4;
12
+ const clamp = (n, min, max) => Math.max(min, max === undefined ? n : Math.min(max, n));
13
+ /** Pill stepper for quantities: soft or outline, trash at the floor on cart lines, limits announced via aria-disabled. */
14
+ const QuantityStepper = ({ value, defaultValue, onValueChange, min = 1, max, step = 1, size = "md", variant = "soft", removable = false, onRemove, disabled = false, itemLabel, "data-testid": testId, }) => {
15
+ const { colors } = useCustomTheme();
16
+ const spec = BUTTON_SIZES[size];
17
+ const [inner, setInner] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : min);
18
+ const current = value !== null && value !== void 0 ? value : inner;
19
+ const atMin = current <= min;
20
+ const atMax = max !== undefined && current >= max;
21
+ const trash = removable && atMin;
22
+ const subject = itemLabel ? ` of ${itemLabel}` : "";
23
+ const change = (direction) => {
24
+ const next = clamp(current + direction * step, min, max);
25
+ if (next === current)
26
+ return;
27
+ if (value === undefined)
28
+ setInner(next);
29
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(next);
30
+ };
31
+ const surface = variant === "outline"
32
+ ? { bg: "transparent", boxShadow: `inset 0 0 0 1px ${colors.boxborder[500]}` }
33
+ : { bg: colors.background[100], boxShadow: "none" };
34
+ const button = (kind) => {
35
+ const limited = kind === "dec" ? atMin && !trash : atMax;
36
+ const Icon = kind === "inc" ? Plus : trash ? Trash2 : Minus;
37
+ const label = kind === "inc" ? `Increase quantity${subject}` : trash ? `Remove${itemLabel ? ` ${itemLabel}` : ""}` : `Decrease quantity${subject}`;
38
+ return (_jsx(Box, { as: "button", type: "button", "aria-label": label, "aria-disabled": limited || undefined, disabled: disabled, "data-testid": testId ? `${testId}-${kind}` : undefined, onClick: () => {
39
+ if (limited)
40
+ return;
41
+ if (kind === "dec" && trash)
42
+ onRemove === null || onRemove === void 0 ? void 0 : onRemove();
43
+ else
44
+ change(kind === "inc" ? 1 : -1);
45
+ }, position: "relative", display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0, boxSize: spec.height, borderRadius: "full", color: colors.header[900], opacity: limited || disabled ? LIMIT_OPACITY : 1, cursor: limited || disabled ? "not-allowed" : "pointer", transition: transitionFor(["background-color", "transform", "opacity"]), _hover: limited || disabled ? undefined : { bg: colors.background[200] }, _active: limited || disabled ? undefined : { transform: "scale(0.96)" }, sx: {
46
+ ...focusVisibleStyles(colors),
47
+ ...reducedMotionSx({ "&:active": { transform: "none" } }),
48
+ "&::before": {
49
+ content: '""',
50
+ position: "absolute",
51
+ inset: `max(0px, calc((${MIN_HIT} - ${spec.height}) / -2))`,
52
+ },
53
+ }, children: _jsx(Icon, { size: spec.iconSize, "aria-hidden": true }) }));
54
+ };
55
+ return (_jsxs(Flex, { role: "group", "aria-label": `Quantity${subject}`, display: "inline-flex", align: "center", h: spec.height, borderRadius: "full", ...surface, "data-testid": testId, children: [button("dec"), _jsx(Text, { as: "span", "aria-live": "polite", "aria-atomic": "true", minW: "1.75rem", textAlign: "center", fontSize: spec.fontSize, fontWeight: 600, color: colors.header[900], sx: { fontVariantNumeric: "tabular-nums" }, children: current }), button("inc")] }));
56
+ };
57
+ export default QuantityStepper;
@@ -0,0 +1,79 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useRef, useState } from "react";
3
+ import { Box, Flex, Text } from "@chakra-ui/react";
4
+ import { Star } from "lucide-react";
5
+ import { useCustomTheme } from "../../Theme/useCustomTheme.js";
6
+ import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
7
+ import { reducedMotionSx, usePrefersReducedMotion } from "../../Theme/chakra/motion.js";
8
+ import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
9
+ import { DEFAULT_LOCALE } from "../../Utils/price.js";
10
+ const STAR_PX = { xs: 12, sm: 14, md: 18, lg: 24 };
11
+ const HIT_PX = { xs: 24, sm: 28, md: 44, lg: 44 };
12
+ const TEXT_SIZE = { xs: "xs", sm: "xs", md: "sm", lg: "md" };
13
+ const GAP_PX = { xs: 1, sm: 1, md: 2, lg: 2 };
14
+ const clamp = (n, lo, hi) => Math.min(hi, Math.max(lo, n));
15
+ const tenth = (n) => Math.round(n * 10) / 10;
16
+ const StarGlyph = ({ px, fillPercent, filled, empty }) => (_jsxs(Box, { as: "span", "aria-hidden": true, position: "relative", display: "inline-flex", boxSize: `${px}px`, flexShrink: 0, color: empty, children: [_jsx(Star, { size: px, fill: "currentColor", strokeWidth: 1.5 }), fillPercent > 0 && (_jsx(Box, { as: "span", "data-fill": fillPercent, position: "absolute", inset: 0, color: filled, sx: {
17
+ clipPath: `inset(0 ${100 - fillPercent}% 0 0)`,
18
+ "[dir=rtl] &": { clipPath: `inset(0 0 0 ${100 - fillPercent}%)` },
19
+ }, children: _jsx(Star, { size: px, fill: "currentColor", strokeWidth: 1.5 }) }))] }));
20
+ const fillOf = (index, value) => clamp(value - index, 0, 1) * 100;
21
+ /** Star rating with fractional fill; becomes a radio group for "write a review" when `onValueChange` is set. */
22
+ const Rating = ({ value, defaultValue = 0, max = 5, size = "sm", showValue = true, count, compactCount = false, locale = DEFAULT_LOCALE, onValueChange, isDisabled = false, "aria-label": ariaLabel, "data-testid": testId, }) => {
23
+ const { colors } = useCustomTheme();
24
+ const [inner, setInner] = useState(defaultValue);
25
+ const [hover, setHover] = useState(null);
26
+ const reduced = usePrefersReducedMotion();
27
+ const refs = useRef([]);
28
+ const interactive = !!onValueChange;
29
+ const current = tenth(clamp(value !== null && value !== void 0 ? value : (interactive ? inner : 0), 0, max));
30
+ const px = STAR_PX[size];
31
+ const nf = new Intl.NumberFormat(locale);
32
+ const valueText = new Intl.NumberFormat(locale, { minimumFractionDigits: 1, maximumFractionDigits: 1 }).format(current);
33
+ const countText = count === undefined
34
+ ? null
35
+ : compactCount
36
+ ? new Intl.NumberFormat(locale, { notation: "compact", maximumFractionDigits: 1 }).format(count)
37
+ : nf.format(count);
38
+ const summary = (_jsxs(_Fragment, { children: [showValue && current > 0 && (_jsx(Text, { as: "span", fontSize: TEXT_SIZE[size], fontWeight: 600, color: colors.header[900], sx: { fontVariantNumeric: "tabular-nums" }, children: valueText })), countText !== null && (_jsxs(Text, { as: "span", fontSize: TEXT_SIZE[size], color: colors.textMuted, sx: { fontVariantNumeric: "tabular-nums" }, children: ["(", countText, ")"] }))] }));
39
+ if (!interactive) {
40
+ const label = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : (current === 0 && !count
41
+ ? "Not rated yet"
42
+ : `Rated ${valueText} out of ${nf.format(max)}${count ? ` from ${nf.format(count)} ${count === 1 ? "rating" : "ratings"}` : ""}`);
43
+ return (_jsxs(Flex, { as: "span", role: "img", "aria-label": label, "data-testid": testId, display: "inline-flex", align: "center", gap: 1.5, verticalAlign: "middle", children: [_jsx(Flex, { as: "span", "aria-hidden": true, gap: `${GAP_PX[size]}px`, children: Array.from({ length: max }, (_, i) => (_jsx(StarGlyph, { px: px, fillPercent: fillOf(i, current), filled: colors.star, empty: colors.boxborder[300] }, i))) }), summary] }));
44
+ }
45
+ const select = (next) => {
46
+ if (isDisabled)
47
+ return;
48
+ if (value === undefined)
49
+ setInner(next);
50
+ onValueChange(next);
51
+ };
52
+ const chosen = Math.round(current);
53
+ const focusStop = chosen > 0 ? chosen : 1;
54
+ const shown = hover !== null && hover !== void 0 ? hover : chosen;
55
+ const onKeyDown = (e) => {
56
+ var _a;
57
+ const move = {
58
+ ArrowRight: chosen + 1,
59
+ ArrowUp: chosen + 1,
60
+ ArrowLeft: chosen - 1,
61
+ ArrowDown: chosen - 1,
62
+ Home: 1,
63
+ End: max,
64
+ };
65
+ if (!(e.key in move))
66
+ return;
67
+ e.preventDefault();
68
+ const next = clamp(move[e.key], 1, max);
69
+ select(next);
70
+ (_a = refs.current[next - 1]) === null || _a === void 0 ? void 0 : _a.focus();
71
+ };
72
+ return (_jsxs(Flex, { as: "span", display: "inline-flex", align: "center", gap: 1.5, "data-testid": testId, children: [_jsx(Flex, { as: "span", role: "radiogroup", "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : "Rating", "aria-disabled": isDisabled || undefined, gap: `${GAP_PX[size]}px`, onMouseLeave: () => setHover(null), children: Array.from({ length: max }, (_, i) => {
73
+ const n = i + 1;
74
+ return (_jsx(Box, { as: "button", type: "button", role: "radio", ref: (el) => {
75
+ refs.current[i] = el;
76
+ }, "aria-checked": n === chosen, "aria-label": `${n} ${n === 1 ? "star" : "stars"}`, tabIndex: n === focusStop && !isDisabled ? 0 : -1, disabled: isDisabled, onClick: () => select(n), onKeyDown: onKeyDown, onMouseEnter: () => !isDisabled && setHover(n), display: "inline-flex", alignItems: "center", justifyContent: "center", boxSize: `${HIT_PX[size]}px`, mx: `-${(HIT_PX[size] - px) / 2 - 1}px`, borderRadius: "full", cursor: isDisabled ? "not-allowed" : "pointer", opacity: isDisabled ? 0.5 : 1, transition: transitionFor(["transform"]), _active: isDisabled || reduced ? undefined : { transform: "scale(0.88)" }, sx: { ...focusVisibleStyles(colors), ...reducedMotionSx() }, children: _jsx(StarGlyph, { px: px, fillPercent: fillOf(i, shown), filled: colors.star, empty: colors.boxborder[300] }) }, n));
77
+ }) }), summary] }));
78
+ };
79
+ export default Rating;
@@ -0,0 +1 @@
1
+ export {};
@@ -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;
@@ -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, option.label, option.count != null && (_jsx(Tag, { label: formatCount(option.count), size: COUNT_TAG_SIZE[size], variant: "subtle", colorScheme: "gray" }))] }, option.value));
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({ left: nodeRect.left - trackRect.left, width: nodeRect.width });
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
- 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": menuDisabled(item) ? true : undefined, textDecoration: "none", py: 2, mb: "2px", borderRadius: "lg", display: "flex", alignItems: "center", justifyContent: "center", cursor: menuDisabled(item) ? "not-allowed" : "pointer", opacity: menuDisabled(item) ? 0.6 : 1, borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", _hover: {
37
- bg: menuDisabled(item)
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 (!menuDisabled(item))
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: menuDisabled(item) ? "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 })] }), badgeVal != null && (_jsx(Badge, { ...softBadge(theme.colors, colorScheme, sidebarRowPeak(theme.colors.sidebar.elevated)), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal }))] }) }) }) })] }));
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
- return (_jsxs(Flex, { as: "a", href: (_a = item.url) !== null && _a !== void 0 ? _a : "#", "data-group": "", "aria-current": isActive ? "page" : undefined, "aria-disabled": menuDisabled(item) ? true : undefined, textDecoration: "none", px: 2, py: "7px", mb: "2px", borderRadius: "lg", align: "center", justify: "space-between", gap: 2, overflow: "hidden", cursor: menuDisabled(item) ? "not-allowed" : "pointer", opacity: menuDisabled(item) ? 0.6 : 1, bg: isActive ? "whiteAlpha.300" : "transparent", _hover: {
54
- bg: menuDisabled(item) ? "transparent" : isActive ? "whiteAlpha.400" : "whiteAlpha.200",
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 (!menuDisabled(item))
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
- return (_jsxs(_Fragment, { children: [_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) => {
114
- if (!hasSubMenu && url && isBrowserNavigationGesture(e))
115
- return;
116
- e.preventDefault();
117
- handleToggleSubMenu(e);
118
- }, "data-menu-id": String((_d = menu.id) !== null && _d !== void 0 ? _d : title), children: buttonContent }), 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: {
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
- return (_jsxs(Box, { as: "a", href: (_a = sub.url) !== null && _a !== void 0 ? _a : "#", "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: {
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
- })()] }, `${String((_c = (_b = sub.id) !== null && _b !== void 0 ? _b : sub.title) !== null && _c !== void 0 ? _c : sIdx)}-${sIdx}`));
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;